# HG changeset patch # User Joerg Sonnenberger # Date 2021-01-27 02:07:14 # Node ID fa7ae7aa0efd2895768a0ad57339a2030fb0fac6 # Parent 7a93b7b3dc2d3b23af5a44321ac3c72ccaf6e6a1 changegroup: don't convert revisions to node for duplicate handling The only consumer can handle revision lists fine. Avoid materializing a range if there are no duplicates as optimization. Differential Revision: https://phab.mercurial-scm.org/D9884 diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -316,11 +316,11 @@ class cg1unpacker(object): 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 @@ class cg1unpacker(object): 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: