Patchwork D9884: changegroup: don't convert revisions to node for duplicate handling

login
register
mail settings
Submitter phabricator
Date Jan. 27, 2021, 2:11 a.m.
Message ID <differential-rev-PHID-DREV-xdxf767coajqcdbeev2d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48193/
State Superseded
Headers show

Comments

phabricator - Jan. 27, 2021, 2:11 a.m.
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The only consumer can handle revision lists fine. Avoid
  materializing a range if there are no duplicates as optimization.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9884

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -316,11 +316,11 @@ 
             self.callback = progress.increment
 
             efilesset = set()
-            cgnodes = []
+            duprevs = []
 
             def ondupchangelog(cl, rev):
                 if rev < clstart:
-                    cgnodes.append(cl.node(rev))
+                    duprevs.append(rev)
 
             def onchangelog(cl, rev):
                 ctx = cl.changelogrevision(rev)
@@ -448,8 +448,12 @@ 
             if added:
                 phases.registernew(repo, tr, targetphase, added)
             if phaseall is not None:
-                phases.advanceboundary(repo, tr, phaseall, cgnodes, revs=added)
-                cgnodes = []
+                if duprevs:
+                    duprevs.extend(added)
+                else:
+                    duprevs = added
+                phases.advanceboundary(repo, tr, phaseall, [], revs=duprevs)
+                duprevs = []
 
             if changesets > 0: