diff hgext/histedit.py @ 18913:79580b3140cd

histedit: support editing of the first commit (issue3767)
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 12 Apr 2013 16:01:18 -0700
parents 3e92772d5383
children 93f3a06b2035
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Apr 12 17:00:42 2013 -0400
+++ b/hgext/histedit.py	Fri Apr 12 16:01:18 2013 -0700
@@ -580,14 +580,15 @@
     # 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 = _('%s is not an ancestor of working directory')
-        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 parentctx.node() != node.nullid:
+        if not newchildren:
+            # `parentctxnode` should match but no result. This means that
+            # currentnode is not a descendant from parentctxnode.
+            msg = _('%s is not an ancestor of working directory')
+            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
     # Commit dirty working directory if necessary
     new = None
     m, a, r, d = repo.status()[:4]