From 0b6046450eddcd6c63c7edb7d20c8f7b6b48f64b Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Mon, 8 Mar 2010 00:55:12 -0600 Subject: [PATCH] Take care of some pesky whitespace issues --- src/mw/clicommands.py | 2 +- src/mw/metadir.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mw/clicommands.py b/src/mw/clicommands.py index 8f951a6..e44f0d8 100644 --- a/src/mw/clicommands.py +++ b/src/mw/clicommands.py @@ -143,4 +143,4 @@ class DiffCommand(CommandBase): if status[file] == 'U': print self.metadir.diff_rv_to_working( mw.api.filename_to_pagename(file[:-5]) - ) + ), diff --git a/src/mw/metadir.py b/src/mw/metadir.py index eb4e565..18811db 100644 --- a/src/mw/metadir.py +++ b/src/mw/metadir.py @@ -147,6 +147,8 @@ class Metadir(object): rvid = self.pages_get_rv_list(pageid)[-1] rv = self.pages_get_rv(pageid, rvid) cur_content = codecs.open(full, 'r', 'utf-8').read() + if cur_content[-1] == '\n': + cur_content = cur_content[:-1] if cur_content != rv['content']: status[os.path.relpath(full, self.root)] = 'U' return status @@ -166,6 +168,8 @@ class Metadir(object): old = [i+'\n' for i in oldrv['content'].split('\n')] if newrvid == 0: cur_content = codecs.open(filename, 'r', 'utf-8').read() + if cur_content[-1] == '\n': + cur_content = cur_content[:-1] newname = 'b/%s (working copy)' % filename new = [i+'\n' for i in cur_content.split('\n')] else: @@ -175,4 +179,7 @@ class Metadir(object): diff_fd = StringIO() bzrlib.diff.internal_diff(oldname, old, newname, new, diff_fd) diff_fd.seek(0) - return diff_fd.read() + diff = diff_fd.read() + if diff[-1] == '\n': + diff = diff[:-1] + return diff -- 2.39.5