Mercurial > evolve
changeset 2787:ebca049e8ca9
amend: use precheck to validate revision
This gives us standard check and standard error message.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 23 Jul 2017 21:20:46 +0200 |
parents | ae690d39fc92 |
children | 554c069cdc85 |
files | hgext3rd/evolve/cmdrewrite.py tests/test-sharing.t |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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