Mercurial > evolve
changeset 6331:9c243e98d0be
prune: raise InputError when validating/suggesting user input
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 20 Nov 2022 17:29:14 +0400 |
parents | 7650b38961a2 |
children | 58ba40d1f2c7 |
files | hgext3rd/evolve/cmdrewrite.py tests/test-prune.t |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py Sun Nov 20 17:16:47 2022 +0400 +++ b/hgext3rd/evolve/cmdrewrite.py Sun Nov 20 17:29:14 2022 +0400 @@ -931,7 +931,7 @@ rewriteutil.deletebookmark(repo, repomarks, bookmarks) if not revs: - raise error.Abort(_(b'no revisions specified to prune')) + raise compat.InputError(_(b'no revisions specified to prune')) wlock = lock = tr = None try: @@ -953,20 +953,20 @@ sucs.sort() sucs = tuple(repo[n] for n in sucs) if not biject and len(sucs) > 1 and len(precs) > 1: - msg = b"Can't use multiple successors for multiple precursors" + msg = b"cannot use multiple successors for multiple precursors" hint = _(b"use --pair to mark a series as a replacement" b" for another") - raise error.Abort(msg, hint=hint) + raise compat.InputError(msg, hint=hint) elif biject and len(sucs) != len(precs): - msg = b"Can't use %d successors for %d precursors"\ + msg = b"cannot use %d successors for %d precursors"\ % (len(sucs), len(precs)) - raise error.Abort(msg) + raise compat.InputError(msg) elif (len(precs) == 1 and len(sucs) > 1) and not split: msg = b"please add --split if you want to do a split" - raise error.Abort(msg) + raise compat.InputError(msg) elif len(sucs) == 1 and len(precs) > 1 and not fold: msg = b"please add --fold if you want to do a fold" - raise error.Abort(msg) + raise compat.InputError(msg) elif biject: replacements = {(p.node(),): [s.node()] for p, s in zip(precs, sucs)} else:
--- a/tests/test-prune.t Sun Nov 20 17:16:47 2022 +0400 +++ b/tests/test-prune.t Sun Nov 20 17:29:14 2022 +0400 @@ -172,7 +172,7 @@ $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")' abort: please add --split if you want to do a split - [255] + [10] $ hg prune 'desc("add dd")' -s 'desc("add nD")' -s 'desc("add nC")' --split 1 changesets pruned $ hg debugobsolete @@ -201,9 +201,9 @@ two old, two new (should be denied) $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nD")' -s 'desc("add nC")' - abort: Can't use multiple successors for multiple precursors + abort: cannot use multiple successors for multiple precursors (use --pair to mark a series as a replacement for another) - [255] + [10] $ hg debugobsolete 9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'} 7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {1f0dee641bb7258c56bd60e93edfa2405381c41e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'} @@ -216,7 +216,7 @@ $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")' abort: please add --fold if you want to do a fold - [255] + [10] $ hg prune 'desc("add cc")' 'desc("add bb")' -s 'desc("add nB")' --fold 2 changesets pruned $ hg debugobsolete @@ -295,7 +295,7 @@ $ hg prune -B nostrip bookmark 'nostrip' deleted abort: no revisions specified to prune - [255] + [10] $ hg tag --remove --local a $ hg prune -B todelete 0 files updated, 0 files merged, 0 files removed, 0 files unresolved