hgext/histedit.py
changeset 17757 fec69c72e2b4
parent 17738 b8424c92ba2b
parent 17750 bb6149f1db83
child 17758 5863f0e4cd3a
--- a/hgext/histedit.py	Wed Mar 21 16:53:39 2012 -0500
+++ b/hgext/histedit.py	Fri Oct 12 15:52:59 2012 -0500
@@ -550,21 +550,20 @@
 
 def bootstrapcontinue(ui, repo, parentctx, existing, replacemap, rules,
                       tmpnodes, created, replaced, opts):
-    currentparent, wantnull = repo.dirstate.parents()
-    # existing is the list of revisions initially considered by
-    # histedit. Here we use it to list new changesets, descendants
-    # of parentctx without an 'existing' changeset in-between. We
-    # also have to exclude 'existing' changesets which were
-    # previously dropped.
-    descendants = set(c.node() for c in
-            repo.set('(%d::) - %d', parentctx, parentctx))
-    notdropped = set(n for n in existing if n in descendants and
-            (n not in replacemap or replacemap[n] in descendants))
-    # Discover any nodes the user has added in the interim. We can
-    # miss changesets which were dropped and recreated the same.
-    newchildren = list(c.node() for c in repo.set(
-        'sort(%ln - (%ln or %ln::))', descendants, existing, notdropped))
     action, currentnode = rules.pop(0)
+    # is there any new commit between the expected parent and "."
+    #
+    # note: does not take non linear new change in account (but previous
+    #       implementation didn't used them anyway (issue3655)
+    newchildren = [c.node() for c in repo.set('(%d::.)', parentctx)]
+    if not newchildren:
+        # `parentctxnode` should match but no result. This means that
+        # currentnode is not a descendant from parentctxnode.
+        msg = _('working directory parent is not a descendant of %s')
+        hint = _('update to %s or descendant and run "hg histedit '
+                 '--continue" again') % parentctx
+        raise util.Abort(msg % parentctx, hint=hint)
+    newchildren.pop(0)  # remove parentctxnode
     if action in ('f', 'fold'):
         tmpnodes.extend(newchildren)
     else:
@@ -696,14 +695,12 @@
             return
         while new in replacemap:
             new = replacemap[new]
-        ui.note(_('histedit:  %s to %s\n') % (node.short(old),
-                                              node.short(new)))
         octx = repo[old]
         marks = octx.bookmarks()
         if marks:
-            ui.note(_('histedit:     moving bookmarks %s\n') %
-                      ', '.join(marks))
             for mark in marks:
+                ui.note(_('histedit: moving bookmarks %s from %s to %s\n')
+                        % (mark, octx, node.short(new)))
                 repo._bookmarks[mark] = new
             bookmarks.write(repo)