localrepo.commit: only munge comment text if committing via dirstate
authorBryan O'Sullivan <bos@serpentine.com>
Thu, 26 Jul 2007 14:47:31 -0700
changeset 5023 7f5c3fb0a37d
parent 5022 6d1d97b09384
child 5024 7963438881f5
localrepo.commit: only munge comment text if committing via dirstate
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Jul 26 14:08:39 2007 -0700
+++ b/mercurial/localrepo.py	Thu Jul 26 14:47:31 2007 -0700
@@ -789,14 +789,17 @@
                 text = self.ui.edit("\n".join(edittext), user)
                 os.chdir(olddir)
 
-            lines = [line.rstrip() for line in text.rstrip().splitlines()]
-            while lines and not lines[0]:
-                del lines[0]
-            if not lines:
-                return None
-            text = '\n'.join(lines)
             if branchname:
                 extra["branch"] = branchname
+
+            if use_dirstate:
+                lines = [line.rstrip() for line in text.rstrip().splitlines()]
+                while lines and not lines[0]:
+                    del lines[0]
+                if not lines:
+                    return None
+                text = '\n'.join(lines)
+
             n = self.changelog.add(mn, changed + removed, text, trp, p1, p2,
                                    user, date, extra)
             self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,