amend: use precheck to validate revision
This gives us standard check and standard error message.
--- a/hgext3rd/evolve/cmdrewrite.py Sun Jul 23 20:33:19 2017 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py Sun Jul 23 21:20:46 2017 +0200
@@ -114,7 +114,13 @@
opts['message'] = repo['.'].description()
_resolveoptions(ui, opts)
_alias, commitcmd = cmdutil.findcmd('commit', commands.table)
- return commitcmd[0](ui, repo, *pats, **opts)
+ try:
+ wlock = repo.wlock()
+ lock = repo.lock()
+ rewriteutil.precheck(repo, [repo['.'].rev()], action='amend')
+ return commitcmd[0](ui, repo, *pats, **opts)
+ finally:
+ lockmod.release(lock, wlock)
def _touchedbetween(repo, source, dest, match=None):
touched = set()
--- a/tests/test-sharing.t Sun Jul 23 20:33:19 2017 +0200
+++ b/tests/test-sharing.t Sun Jul 23 21:20:46 2017 +0200
@@ -147,7 +147,8 @@
Now that the fix is public, we cannot amend it any more.
$ hg amend -m 'fix bug 37'
- abort: cannot amend public changesets
+ abort: cannot amend public changesets: de6151c48e1c
+ (see 'hg help phases' for details)
[255]
Figure SG05