changeset 8501:ab0e3f7ea315

commit: some tidying - simplify handling of 'close' - kill silly wlock=None - sort/uniq files later
author Matt Mackall <mpm@selenic.com>
date Mon, 18 May 2009 17:36:24 -0500
parents 1024bef53d9e
children 51b7d2a68e03
files mercurial/localrepo.py
diffstat 1 files changed, 6 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon May 18 17:36:24 2009 -0500
+++ b/mercurial/localrepo.py	Mon May 18 17:36:24 2009 -0500
@@ -769,25 +769,19 @@
 
     def commit(self, files=None, text="", user=None, date=None, match=None,
                force=False, editor=False, extra={}):
-        wlock = None
-        if extra.get("close"):
-            force = True
-        if files:
-            files = list(set(files))
-
         ret = None
         wlock = self.wlock()
         try:
             p1, p2 = self.dirstate.parents()
 
-            if (not force and p2 != nullid and
-                (match and (match.files() or match.anypats()))):
+            if (not force and p2 != nullid and match and
+                (match.files() or match.anypats())):
                 raise util.Abort(_('cannot partially commit a merge '
                                    '(do not specify files or patterns)'))
 
             if files:
                 modified, removed = [], []
-                for f in files:
+                for f in sorted(set(files)):
                     s = self.dirstate[f]
                     if s in 'nma':
                         modified.append(f)
@@ -799,9 +793,9 @@
             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()):
+            if (not force and not extra.get("close") and p2 == nullid
+                and not (changes[0] or changes[1] or changes[2])
+                and self[None].branch() == self['.'].branch()):
                 self.ui.status(_("nothing changed\n"))
                 return None