changeset 6300:f656daf884a4

evolve: remove 4.7 compatibility for scmutil.cleanupnodes()
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 11 Aug 2022 18:03:49 +0400
parents 0f16420c5907
children a649e0e36de7
files hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py
diffstat 2 files changed, 11 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Thu Aug 11 10:38:36 2022 +0400
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Aug 11 18:03:49 2022 +0400
@@ -171,8 +171,8 @@
         if opts.get('note'):
             metadata[b'note'] = opts['note']
         replacements = {(old.node(),): [newnode]}
-        compat.cleanupnodes(repo, replacements, operation=b'amend',
-                            metadata=metadata)
+        scmutil.cleanupnodes(repo, replacements, operation=b'amend',
+                             metadata=metadata)
         phases.retractboundary(repo, tr, old.phase(), [newnode])
         compat.clean_update(repo[newnode])
 
@@ -464,8 +464,8 @@
             metadata[b'note'] = opts['note']
 
         replacements = {(old.node(),): [newid]}
-        compat.cleanupnodes(repo, replacements, operation=b"uncommit",
-                            metadata=metadata)
+        scmutil.cleanupnodes(repo, replacements, operation=b"uncommit",
+                             metadata=metadata)
         phases.retractboundary(repo, tr, oldphase, [newid])
         if opts.get('revert'):
             compat.clean_update(repo[newid])
@@ -698,8 +698,8 @@
                                                         commitopts=commitopts)
             phases.retractboundary(repo, tr, targetphase, [newid])
             replacements = {tuple(ctx.node() for ctx in allctx): [newid]}
-            compat.cleanupnodes(repo, replacements, operation=b"fold",
-                                metadata=metadata)
+            scmutil.cleanupnodes(repo, replacements, operation=b"fold",
+                                 metadata=metadata)
             tr.close()
         finally:
             tr.release()
@@ -1051,8 +1051,8 @@
                     break
         if len(sucs) == 1 and len(precs) > 1 and fold:
             replacements = {tuple(p.node() for p in precs): [s.node() for s in sucs]}
-        compat.cleanupnodes(repo, replacements, operation=b"prune", moves=moves,
-                            metadata=metadata)
+        scmutil.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))
@@ -1413,7 +1413,7 @@
     else:
         newctx = repo[newnode]
         replacements = {(origctx.node(),): [newctx.node()]}
-    compat.cleanupnodes(repo, replacements, operation=b"pick")
+    scmutil.cleanupnodes(repo, replacements, operation=b"pick")
 
     if newnode is None:
         ui.warn(_(b"note: picking %d:%s created no changes to commit\n") %
@@ -1551,7 +1551,7 @@
         )
         phases.retractboundary(repo, tr, target_ctx.phase(), [newid])
         replacements = {tuple(ctx.node() for ctx in allctx): [newid]}
-        compat.cleanupnodes(repo, replacements, operation=b'fixup')
+        scmutil.cleanupnodes(repo, replacements, operation=b'fixup')
         fixup_state.delete()
         compat.update(repo.unfiltered()[tempnode])
         return 0
@@ -1579,7 +1579,7 @@
         )
         phases.retractboundary(repo, tr, target_ctx.phase(), [newid])
         replacements = {tuple(ctx.node() for ctx in allctx): [newid]}
-        compat.cleanupnodes(repo, replacements, operation=b'fixup')
+        scmutil.cleanupnodes(repo, replacements, operation=b'fixup')
         fixup_state.delete()
         compat.update(repo.unfiltered()[tempnode])
         return 0
--- a/hgext3rd/evolve/compat.py	Thu Aug 11 10:38:36 2022 +0400
+++ b/hgext3rd/evolve/compat.py	Thu Aug 11 18:03:49 2022 +0400
@@ -387,21 +387,6 @@
     def clean_update(ctx):
         hg.updaterepo(ctx.repo(), ctx.node(), overwrite=True)
 
-def cleanupnodes(repo, replacements, operation, moves=None, metadata=None):
-    # Use this condition as a proxy since the commit we care about
-    # (b99903534e06) didn't change any signatures.
-    if util.safehasattr(scmutil, 'nullrev'):
-        fixedreplacements = replacements
-    else:
-        # hg <= 4.7 (b99903534e06)
-        fixedreplacements = {}
-        for oldnodes, newnodes in replacements.items():
-            for oldnode in oldnodes:
-                fixedreplacements[oldnode] = newnodes
-
-    scmutil.cleanupnodes(repo, replacements=fixedreplacements, operation=operation,
-                         moves=moves, metadata=metadata)
-
 if util.safehasattr(cmdutil, 'format_changeset_summary'):
     def format_changeset_summary_fn(ui, repo, command, default_spec):
         def show(ctx):