Patchwork [2,of,4,V3] histedit: use safecleanupnode in _finishhistedit

login
register
mail settings
Submitter Jun Wu
Date March 21, 2017, 12:15 a.m.
Message ID <bcfb0ab9c1a8a36682ce.1490055329@localhost.localdomain>
Download mbox | patch
Permalink /patch/19486/
State Accepted
Headers show

Comments

Jun Wu - March 21, 2017, 12:15 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1489468746 25200
#      Mon Mar 13 22:19:06 2017 -0700
# Node ID bcfb0ab9c1a8a36682cea3ac5410d9c80431f9bd
# Parent  016fcb6e44e0e903d590b63135fa785955068737
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r bcfb0ab9c1a8
histedit: use safecleanupnode in _finishhistedit

This simplifies code a lot.

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1170,11 +1170,5 @@  def _finishhistedit(ui, repo, state):
                         ui.debug(m % node.short(n))
 
-    supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
-    if supportsmarkers:
-        # Only create markers if the temp nodes weren't already removed.
-        obsolete.createmarkers(repo, ((repo[t],()) for t in sorted(tmpnodes)
-                                       if t in repo))
-    else:
-        cleanupnode(ui, repo, 'temp', tmpnodes)
+    safecleanupnode(ui, repo, 'temp', tmpnodes)
 
     if not state.keep:
@@ -1182,15 +1176,5 @@  def _finishhistedit(ui, repo, state):
             movebookmarks(ui, repo, mapping, state.topmost, ntm)
             # TODO update mq state
-        if supportsmarkers:
-            markers = []
-            # sort by revision number because it sound "right"
-            for prec in sorted(mapping, key=repo.changelog.rev):
-                succs = mapping[prec]
-                markers.append((repo[prec],
-                                tuple(repo[s] for s in succs)))
-            if markers:
-                obsolete.createmarkers(repo, markers)
-        else:
-            cleanupnode(ui, repo, 'replaced', mapping)
+        safecleanupnode(ui, repo, 'replaced', mapping)
 
     state.clear()