Mercurial > evolve
changeset 5548:7370725cdba7 stable
compat: add a cleanupnodes() function
This first patch just makes it delegate to
scmutil.cleanupnodes(). Coming patches will add a bit more logic to
it.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 26 Aug 2020 08:18:59 -0700 |
parents | 6cd66a5bfb04 |
children | d83b24d38853 |
files | hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py |
diffstat | 2 files changed, 25 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Tue Aug 25 22:34:33 2020 -0700 +++ b/hgext3rd/evolve/cmdrewrite.py Wed Aug 26 08:18:59 2020 -0700 @@ -170,8 +170,8 @@ if opts.get('note'): metadata[b'note'] = opts['note'] replacements = {old.node(): [newnode]} - scmutil.cleanupnodes(repo, replacements, operation=b'amend', - metadata=metadata) + compat.cleanupnodes(repo, replacements, operation=b'amend', + metadata=metadata) phases.retractboundary(repo, tr, old.phase(), [newnode]) hg.updaterepo(repo, newnode, True) @@ -509,8 +509,8 @@ metadata[b'note'] = opts['note'] replacements = {old.node(): [newid]} - scmutil.cleanupnodes(repo, replacements, operation=b"uncommit", - metadata=metadata) + compat.cleanupnodes(repo, replacements, operation=b"uncommit", + metadata=metadata) phases.retractboundary(repo, tr, oldphase, [newid]) if opts.get('revert'): hg.updaterepo(repo, newid, True) @@ -749,13 +749,13 @@ # (b99903534e06) didn't change any signatures. if util.safehasattr(scmutil, 'nullrev'): replacements = {tuple(ctx.node() for ctx in allctx): [newid]} - scmutil.cleanupnodes(repo, replacements, operation=b"fold", - metadata=metadata) + compat.cleanupnodes(repo, replacements, operation=b"fold", + metadata=metadata) else: # hg <= 4.7 (b99903534e06) replacements = {ctx.node(): [newid] for ctx in allctx} - scmutil.cleanupnodes(repo, replacements, operation=b"fold", - metadata=metadata) + compat.cleanupnodes(repo, replacements, operation=b"fold", + metadata=metadata) tr.close() finally: tr.release() @@ -885,14 +885,18 @@ # Use this condition as a proxy since the commit we care about # (b99903534e06) didn't change any signatures. if util.safehasattr(scmutil, 'nullrev'): - mapping = {tuple(ctx.node() for ctx in allctx): (newid,)} - scmutil.cleanupnodes(repo, mapping, operation=b"metaedit", - metadata=metadata) + replacements = { + tuple(ctx.node() for ctx in allctx): (newid,) + } + compat.cleanupnodes(repo, replacements, + operation=b"metaedit", + metadata=metadata) else: # hg <= 4.7 (b99903534e06) - mapping = {ctx.node(): (newid,) for ctx in allctx} - scmutil.cleanupnodes(repo, mapping, operation=b"metaedit", - metadata=metadata) + replacements = {ctx.node(): (newid,) for ctx in allctx} + compat.cleanupnodes(repo, replacements, + operation=b"metaedit", + metadata=metadata) else: ui.status(_(b"nothing changed\n")) tr.close() @@ -1121,8 +1125,8 @@ # Using a proxy condition to let people wrap cleanupnodes() if util.safehasattr(scmutil, 'nullrev'): replacements = {tuple(p.node() for p in precs): [s.node() for s in sucs]} - scmutil.cleanupnodes(repo, replacements, operation=b"prune", moves=moves, - metadata=metadata) + compat.cleanupnodes(repo, replacements, operation=b"prune", moves=moves, + metadata=metadata) # informs that changeset have been pruned ui.status(_(b'%i changesets pruned\n') % len(precs)) @@ -1480,7 +1484,7 @@ else: newctx = repo[newnode] replacements = {origctx.node(): [newctx.node()]} - scmutil.cleanupnodes(repo, replacements, operation=b"pick") + compat.cleanupnodes(repo, replacements, operation=b"pick") if newnode is None: ui.warn(_(b"note: picking %d:%s created no changes to commit\n") %
--- a/hgext3rd/evolve/compat.py Tue Aug 25 22:34:33 2020 -0700 +++ b/hgext3rd/evolve/compat.py Wed Aug 26 08:18:59 2020 -0700 @@ -386,3 +386,7 @@ # hg <= 5.2 (85c4cd73996b) if util.safehasattr(repo, '_quick_access_changeid_invalidate'): repo._quick_access_changeid_invalidate() + +def cleanupnodes(repo, replacements, operation, moves=None, metadata=None): + scmutil.cleanupnodes(repo, replacements=replacements, operation=operation, + moves=moves, metadata=metadata)