[PATCH 2 of 4] changelog: keep track of duplicated node in the transaction adding them

Boris Feld boris.feld at octobus.net
Thu Sep 27 12:49:50 EDT 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1537435108 -7200
#      Thu Sep 20 11:18:28 2018 +0200
# Node ID 6000c641cd3740dc4d3068a05ada707213983b29
# Parent  1bed338fee8612ca502b2ef462c8cd7a59efe0aa
# EXP-Topic revlog-duplicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6000c641cd37
changelog: keep track of duplicated node in the transaction adding them

The transaction is already tracking the new nodes. We now tracks the
"duplicates" in the same location.

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -545,3 +545,10 @@ class changelog(revlog.revlog):
         just to access this is costly."""
         extra = self.read(rev)[5]
         return encoding.tolocal(extra.get("branch")), 'close' in extra
+
+    def _nodeduplicatecallback(self, transaction, node):
+        # keep track of revisions that got "re-added", eg: unbunde of know rev.
+        #
+        # We track them in a list to preserve their order from the source bundle
+        duplicates = transaction.changes.setdefault('revduplicates', [])
+        duplicates.append(self.rev(node))


More information about the Mercurial-devel mailing list