# HG changeset patch # User Joerg Sonnenberger # Date 2021-01-27 02:07:14 # Node ID f7fd34afd1cc61973e217973566d4aa5d2354ed5 # Parent 8ce2d7d993a56419412b1261b7bab4a670f59147 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: