Mercurial > evolve
changeset 6321:58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 10 Oct 2022 20:02:14 +0400 |
parents | 0c780d972350 |
children | 57f9cdbf6a99 |
files | hgext3rd/topic/compat.py hgext3rd/topic/discovery.py tests/test-topic-push.t |
diffstat | 3 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/compat.py Thu Apr 07 20:42:56 2022 +0300 +++ b/hgext3rd/topic/compat.py Mon Oct 10 20:02:14 2022 +0400 @@ -58,6 +58,12 @@ # hg <= 5.6 (8d72e29ad1e0) InputError = error.Abort +if util.safehasattr(error, 'StateError'): + StateError = error.StateError +else: + # hg <= 5.6 (527ce85c2e60) + StateError = error.Abort + if util.safehasattr(cmdutil, 'check_at_most_one_arg'): def check_at_most_one_arg(opts, *args): return cmdutil.check_at_most_one_arg(opts, *args)
--- a/hgext3rd/topic/discovery.py Thu Apr 07 20:42:56 2022 +0300 +++ b/hgext3rd/topic/discovery.py Mon Oct 10 20:02:14 2022 +0400 @@ -284,7 +284,7 @@ b"push creates new heads on branch '%s': %s" % (branch, heads) ) - raise error.Abort(msg) + raise compat.StateError(msg) for branch, newnb in finalheads.items(): if 1 < len(newnb): cl = repo.changelog @@ -295,7 +295,7 @@ ) hint = _(b"merge or see 'hg help push' for details about " b"pushing new heads") - raise error.Abort(msg, hint=hint) + raise compat.StateError(msg, hint=hint) def validator(tr): _validate(tr)