changeset 8399:1c3d5c54cf1c

commitctx: replace two dirstate vars with working
author Matt Mackall <mpm@selenic.com>
date Thu, 14 May 2009 13:20:40 -0500
parents a45eb410e0f2
children 9eecc471aca3
files mercurial/localrepo.py
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
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
@@ -816,8 +816,7 @@
                                                     "(see hg resolve)"))
             wctx = context.workingctx(self, (p1, p2), text, user, date,
                                       extra, changes)
-            r = self._commitctx(wctx, force, force_editor, empty_ok,
-                                True, True)
+            r = self._commitctx(wctx, force, force_editor, empty_ok, True)
             ms.reset()
             return r
 
@@ -833,13 +832,12 @@
         lock = self.lock()
         try:
             return self._commitctx(ctx, force=True, force_editor=False,
-                                   empty_ok=True, use_dirstate=False,
-                                   update_dirstate=False)
+                                   empty_ok=True, working=False)
         finally:
             lock.release()
 
     def _commitctx(self, wctx, force=False, force_editor=False, empty_ok=False,
-                  use_dirstate=True, update_dirstate=True):
+                   working=True):
         tr = None
         valid = 0 # don't save the dirstate if this isn't set
         try:
@@ -856,7 +854,7 @@
             m1 = self.manifest.read(c1[0]).copy()
             m2 = self.manifest.read(c2[0])
 
-            if use_dirstate:
+            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):
@@ -890,11 +888,11 @@
                         if m1.flags(f) != newflags:
                             changed.append(f)
                     m1.set(f, newflags)
-                    if use_dirstate:
+                    if working:
                         self.dirstate.normal(f)
 
                 except (OSError, IOError):
-                    if use_dirstate:
+                    if working:
                         self.ui.warn(_("trouble committing %s!\n") % f)
                         raise
                     else:
@@ -950,7 +948,7 @@
             lines = [line.rstrip() for line in text.rstrip().splitlines()]
             while lines and not lines[0]:
                 del lines[0]
-            if not lines and use_dirstate:
+            if not lines and working:
                 raise util.Abort(_("empty commit message"))
             text = '\n'.join(lines)
 
@@ -966,11 +964,10 @@
             if self.branchcache:
                 self.branchtags()
 
-            if use_dirstate or update_dirstate:
+            if working:
                 self.dirstate.setparents(n)
-                if use_dirstate:
-                    for f in removed:
-                        self.dirstate.forget(f)
+                for f in removed:
+                    self.dirstate.forget(f)
             valid = 1 # our dirstate updates are complete
 
             self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)