commit: move 'nothing changed' test into commit()
authorMatt Mackall <mpm@selenic.com>
Thu, 14 May 2009 13:20:40 -0500
changeset 8404 a2bc39ade36b
parent 8403 553909cd1baa
child 8405 7cbf8fcd2453
commit: move 'nothing changed' test into commit()
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu May 14 13:20:40 2009 -0500
+++ b/mercurial/localrepo.py	Thu May 14 13:20:40 2009 -0500
@@ -799,6 +799,12 @@
             else:
                 changes = self.status(match=match)
 
+            if (not (changes[0] or changes[1] or changes[2])
+                and not force and p2 == nullid and
+                self[None].branch() == self['.'].branch()):
+                self.ui.status(_("nothing changed\n"))
+                return None
+
             ms = merge_.mergestate(self)
             for f in changes[0]:
                 if f in ms and ms[f] == 'u':
@@ -844,13 +850,6 @@
             m1 = self.manifest.read(c1[0]).copy()
             m2 = self.manifest.read(c2[0])
 
-            if working:
-                oldname = c1[5].get("branch") # stored in UTF-8
-                if (not commit and not remove and not force and p2 == nullid
-                    and branchname == oldname):
-                    self.ui.status(_("nothing changed\n"))
-                    return None
-
             xp1 = hex(p1)
             if p2 == nullid: xp2 = ''
             else: xp2 = hex(p2)