diff mercurial/localrepo.py @ 8404:a2bc39ade36b

commit: move 'nothing changed' test into commit()
author Matt Mackall <mpm@selenic.com>
date Thu, 14 May 2009 13:20:40 -0500
parents 553909cd1baa
children 7cbf8fcd2453
line wrap: on
line diff
--- 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)