changeset 4370:45c0415e45b9

fold: use scmutil.cleanupnodes() scmutil.cleanupnodes() has existed since 4.3 and had the metadata argument since 4.4, so we can now safely depend on it.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 22 Jan 2019 09:45:25 -0800
parents 75276f858444
children 9a218768bac5
files hgext3rd/evolve/cmdrewrite.py
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Sat Jan 26 23:58:18 2019 +0800
+++ b/hgext3rd/evolve/cmdrewrite.py	Tue Jan 22 09:45:25 2019 -0800
@@ -776,14 +776,9 @@
                                                          root.p2().node()],
                                                         commitopts=commitopts)
             phases.retractboundary(repo, tr, targetphase, [newid])
-            obsolete.createmarkers(repo, [(ctx, (repo[newid],))
-                                   for ctx in allctx], metadata=metadata,
-                                   operation="fold")
-            # move bookmarks from old nodes to the new one
-            # XXX: we should make rewriteutil.rewrite() handle such cases
-            for ctx in allctx:
-                bmupdater = rewriteutil.bookmarksupdater(repo, ctx.node(), tr)
-                bmupdater(newid)
+            replacements = {ctx.node(): [newid] for ctx in allctx}
+            scmutil.cleanupnodes(repo, replacements, operation="fold",
+                                 metadata=metadata)
             tr.close()
         finally:
             tr.release()