[PATCH 2 of 5] localrepo: take a scope parameter for repo.transaction

Jun Wu quark at fb.com
Mon Feb 27 12:35:26 EST 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1488189365 28800
#      Mon Feb 27 01:56:05 2017 -0800
# Node ID 1462f970a1029043e7b1de4f70c52a4b360ff399
# Parent  5dac612ec9a87553fcd329100846bcb01bae9d80
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 1462f970a102
localrepo: take a scope parameter for repo.transaction

See the previous patch for why.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1039,5 +1039,8 @@ class localrepository(object):
         return None
 
-    def transaction(self, desc, report=None):
+    # default, full scope for a transaction.
+    _scope = frozenset(['dirstate', 'bookmarks', 'branch', 'phaseroots'])
+
+    def transaction(self, desc, report=None, scope=_scope):
         if (self.ui.configbool('devel', 'all-warnings')
                 or self.ui.configbool('devel', 'check-locks')):
@@ -1046,5 +1049,5 @@ class localrepository(object):
         tr = self.currenttransaction()
         if tr is not None:
-            return tr.nest()
+            return tr.nest(scope)
 
         # abort here if the journal already exists
@@ -1093,5 +1096,6 @@ class localrepository(object):
                                      self.store.createmode,
                                      validator=validate,
-                                     releasefn=releasefn)
+                                     releasefn=releasefn,
+                                     scope=scope)
 
         tr.hookargs['txnid'] = txnid


More information about the Mercurial-devel mailing list