precheck: handle rewrite attempt of nullrev
This is a common breaking case, so we handle and test it in the generic code.
--- 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]