[PATCH 1 of 2] transaction: track new obsmarkers in the 'changes' mapping

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Jul 1 23:03:43 UTC 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1498524309 -7200
#      Tue Jun 27 02:45:09 2017 +0200
# Node ID 7f2c9fb4ce2aa427e01ccf02641d218966b580d4
# Parent  6d678ab1b10d0fddc73003d21aa3c7ec43194e2e
# EXP-Topic tr.changes
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 7f2c9fb4ce2a
transaction: track new obsmarkers in the 'changes' mapping

The obsstore collaborate with transaction to make sure we track all the
obsmarkers added during a transaction. This will be useful for various usages:
hooks, caches, better output, etc.

This is the seconds kind of data added to tr.changes (first one was added revisions)

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1078,6 +1078,7 @@ class localrepository(object):
                                      validator=validate,
                                      releasefn=releasefn)
         tr.changes['revs'] = set()
+        tr.changes['obsmarkers'] = set()
 
         tr.hookargs['txnid'] = txnid
         # note: writing the fncache only during finalize mean that the file is
diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -613,6 +613,9 @@ class obsstore(object):
                 # XXX: f.close() == filecache invalidation == obsstore rebuilt.
                 # call 'filecacheentry.refresh()'  here
                 f.close()
+            addedmarkers = transaction.changes.get('obsmarkers')
+            if addedmarkers is not None:
+                addedmarkers.update(new)
             self._addmarkers(new)
             # new marker *may* have changed several set. invalidate the cache.
             self.caches.clear()


More information about the Mercurial-devel mailing list