]> projects.mako.cc - mw/commitdiff
Take care of some pesky whitespace issues
authorIan Weller <ian@ianweller.org>
Mon, 8 Mar 2010 06:55:12 +0000 (00:55 -0600)
committerIan Weller <ian@ianweller.org>
Mon, 8 Mar 2010 06:55:12 +0000 (00:55 -0600)
src/mw/clicommands.py
src/mw/metadir.py

index 8f951a60bed7f6f92c8926fc24c8ee9fa115da3e..e44f0d8b639501a794885cccdf0e2209b63f9131 100644 (file)
@@ -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])
-                )
+                ),
index eb4e56555b63884991093178edcb13794c4820bd..18811db26b38359b8adca2c71d517d53ad29895e 100644 (file)
@@ -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

Benjamin Mako Hill || Want to submit a patch?