changeset 26578:8bd2759f1fa7

dirstate: remove meaningless dirstateguard Previous patch made dirstate changes in a transaction scope "all or nothing". Therefore, 'dirstateguard' is meaningless, if its scope is as same as one of the related transaction. This patch removes such meaningless 'dirstateguard' usage.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 09 Oct 2015 03:53:46 +0900
parents 8f2ff40fe9c9
children dc2b8c005697
files hgext/mq.py hgext/transplant.py mercurial/cmdutil.py
diffstat 3 files changed, 5 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Oct 09 03:53:46 2015 +0900
+++ b/hgext/mq.py	Fri Oct 09 03:53:46 2015 +0900
@@ -816,10 +816,9 @@
     def apply(self, repo, series, list=False, update_status=True,
               strict=False, patchdir=None, merge=None, all_files=None,
               tobackup=None, keepchanges=False):
-        wlock = dsguard = lock = tr = None
+        wlock = lock = tr = None
         try:
             wlock = repo.wlock()
-            dsguard = cmdutil.dirstateguard(repo, 'mq.apply')
             lock = repo.lock()
             tr = repo.transaction("qpush")
             try:
@@ -828,12 +827,10 @@
                                   tobackup=tobackup, keepchanges=keepchanges)
                 tr.close()
                 self.savedirty()
-                dsguard.close()
                 return ret
             except AbortNoCleanup:
                 tr.close()
                 self.savedirty()
-                dsguard.close()
                 raise
             except: # re-raises
                 try:
@@ -843,7 +840,7 @@
                     self.invalidate()
                 raise
         finally:
-            release(tr, lock, dsguard, wlock)
+            release(tr, lock, wlock)
             self.removeundo(repo)
 
     def _apply(self, repo, series, list=False, update_status=True,
--- a/hgext/transplant.py	Fri Oct 09 03:53:46 2015 +0900
+++ b/hgext/transplant.py	Fri Oct 09 03:53:46 2015 +0900
@@ -127,10 +127,9 @@
         diffopts = patch.difffeatureopts(self.ui, opts)
         diffopts.git = True
 
-        lock = wlock = tr = dsguard = None
+        lock = wlock = tr = None
         try:
             wlock = repo.wlock()
-            dsguard = cmdutil.dirstateguard(repo, 'transplant')
             lock = repo.lock()
             tr = repo.transaction('transplant')
             for rev in revs:
@@ -203,7 +202,6 @@
                             # Do not rollback, it is up to the user to
                             # fix the merge or cancel everything
                             tr.close()
-                            dsguard.close()
                             raise
                         if n and domerge:
                             self.ui.status(_('%s merged at %s\n') % (revstr,
@@ -216,7 +214,6 @@
                         if patchfile:
                             os.unlink(patchfile)
             tr.close()
-            dsguard.close()
             if pulls:
                 exchange.pull(repo, source.peer(), heads=pulls)
                 merge.update(repo, pulls[-1], False, False, None)
@@ -227,8 +224,6 @@
                 tr.release()
             if lock:
                 lock.release()
-            if dsguard:
-                dsguard.release()
             wlock.release()
 
     def filter(self, filter, node, changelog, patchfile):
--- a/mercurial/cmdutil.py	Fri Oct 09 03:53:46 2015 +0900
+++ b/mercurial/cmdutil.py	Fri Oct 09 03:53:46 2015 +0900
@@ -2507,10 +2507,9 @@
     base = old.p1()
     createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
 
-    wlock = dsguard = lock = newid = None
+    wlock = lock = newid = None
     try:
         wlock = repo.wlock()
-        dsguard = dirstateguard(repo, 'amend')
         lock = repo.lock()
         tr = repo.transaction('amend')
         try:
@@ -2682,7 +2681,6 @@
             tr.close()
         finally:
             tr.release()
-        dsguard.close()
         if not createmarkers and newid != old.node():
             # Strip the intermediate commit (if there was one) and the amended
             # commit
@@ -2691,7 +2689,7 @@
             ui.note(_('stripping amended changeset %s\n') % old)
             repair.strip(ui, repo, old.node(), topic='amend-backup')
     finally:
-        lockmod.release(lock, dsguard, wlock)
+        lockmod.release(lock, wlock)
     return newid
 
 def commiteditor(repo, ctx, subs, editform=''):