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

login
register
mail settings
Submitter Boris Feld
Date Sept. 27, 2018, 4:49 p.m.
Message ID <6000c641cd3740dc4d30.1538066990@localhost.localdomain>
Download mbox | patch
Permalink /patch/35135/
State Accepted
Headers show

Comments

Boris Feld - Sept. 27, 2018, 4:49 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@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.

Patch

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))