fold: use scmutil.cleanupnodes()
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 22 Jan 2019 09:45:25 -0800
changeset 4370 45c0415e45b9
parent 4369 75276f858444
child 4371 9a218768bac5
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.
hgext3rd/evolve/cmdrewrite.py
--- 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()