Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 46510:fa7ae7aa0efd
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
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Wed, 27 Jan 2021 03:07:14 +0100 |
parents | 7a93b7b3dc2d |
children | c3c7a86e9c24 |
comparison
equal
deleted
inserted
replaced
46509:7a93b7b3dc2d | 46510:fa7ae7aa0efd |
---|---|
314 _(b'changesets'), unit=_(b'chunks'), total=expectedtotal | 314 _(b'changesets'), unit=_(b'chunks'), total=expectedtotal |
315 ) | 315 ) |
316 self.callback = progress.increment | 316 self.callback = progress.increment |
317 | 317 |
318 efilesset = set() | 318 efilesset = set() |
319 cgnodes = [] | 319 duprevs = [] |
320 | 320 |
321 def ondupchangelog(cl, rev): | 321 def ondupchangelog(cl, rev): |
322 if rev < clstart: | 322 if rev < clstart: |
323 cgnodes.append(cl.node(rev)) | 323 duprevs.append(rev) |
324 | 324 |
325 def onchangelog(cl, rev): | 325 def onchangelog(cl, rev): |
326 ctx = cl.changelogrevision(rev) | 326 ctx = cl.changelogrevision(rev) |
327 efilesset.update(ctx.files) | 327 efilesset.update(ctx.files) |
328 repo.register_changeset(rev, ctx) | 328 repo.register_changeset(rev, ctx) |
446 # ignored. | 446 # ignored. |
447 targetphase = phaseall = phases.draft | 447 targetphase = phaseall = phases.draft |
448 if added: | 448 if added: |
449 phases.registernew(repo, tr, targetphase, added) | 449 phases.registernew(repo, tr, targetphase, added) |
450 if phaseall is not None: | 450 if phaseall is not None: |
451 phases.advanceboundary(repo, tr, phaseall, cgnodes, revs=added) | 451 if duprevs: |
452 cgnodes = [] | 452 duprevs.extend(added) |
453 else: | |
454 duprevs = added | |
455 phases.advanceboundary(repo, tr, phaseall, [], revs=duprevs) | |
456 duprevs = [] | |
453 | 457 |
454 if changesets > 0: | 458 if changesets > 0: |
455 | 459 |
456 def runhooks(unused_success): | 460 def runhooks(unused_success): |
457 # These hooks run when the lock releases, not when the | 461 # These hooks run when the lock releases, not when the |