changeset 2785:b5a48e4aeec6

precheck: handle rewrite attempt of nullrev This is a common breaking case, so we handle and test it in the generic code.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 24 Jul 2017 01:45:03 +0200
parents d17d193c4145
children ae690d39fc92
files hgext3rd/evolve/rewriteutil.py tests/test-fold.t
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/rewriteutil.py	Sun Jul 23 19:45:28 2017 +0200
+++ b/hgext3rd/evolve/rewriteutil.py	Mon Jul 24 01:45:03 2017 +0200
@@ -60,6 +60,10 @@
 
     <action> can be used to control the commit message.
     """
+    if node.nullrev in revs:
+        msg = _("cannot %s the null revision") % (action)
+        hint = _("no changeset checked out")
+        raise error.Abort(msg, hint=hint)
     publicrevs = repo.revs('%ld and public()', revs)
     if publicrevs:
         summary = _formatrevs(repo, publicrevs)
--- a/tests/test-fold.t	Sun Jul 23 19:45:28 2017 +0200
+++ b/tests/test-fold.t	Mon Jul 24 01:45:03 2017 +0200
@@ -42,6 +42,10 @@
 
 Test various error case
 
+  $ hg fold --exact null::
+  abort: cannot fold the null revision
+  (no changeset checked out)
+  [255]
   $ hg fold
   abort: no revisions specified
   [255]