# HG changeset patch # User Pierre-Yves David # Date 1500853503 -7200 # Node ID b5a48e4aeec6f2c56e334b9c97cf1dcafe17dbad # Parent d17d193c41450596dbbcb2e774d28ea0fab84713 precheck: handle rewrite attempt of nullrev This is a common breaking case, so we handle and test it in the generic code. diff -r d17d193c4145 -r b5a48e4aeec6 hgext3rd/evolve/rewriteutil.py --- 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 @@ 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) diff -r d17d193c4145 -r b5a48e4aeec6 tests/test-fold.t --- 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]