Commit c9dfcb9a authored by Martin von Zweigbergk's avatar Martin von Zweigbergk

errors: raise InputError in `hg split`

Differential Revision: https://phab.mercurial-scm.org/D9338
parent e641bb2a6159
...@@ -72,7 +72,7 @@ def split(ui, repo, *revs, **opts): ...@@ -72,7 +72,7 @@ def split(ui, repo, *revs, **opts):
with repo.wlock(), repo.lock(), repo.transaction(b'split') as tr: with repo.wlock(), repo.lock(), repo.transaction(b'split') as tr:
revs = scmutil.revrange(repo, revlist or [b'.']) revs = scmutil.revrange(repo, revlist or [b'.'])
if len(revs) > 1: if len(revs) > 1:
raise error.Abort(_(b'cannot split multiple revisions')) raise error.InputError(_(b'cannot split multiple revisions'))
rev = revs.first() rev = revs.first()
ctx = repo[rev] ctx = repo[rev]
...@@ -82,7 +82,7 @@ def split(ui, repo, *revs, **opts): ...@@ -82,7 +82,7 @@ def split(ui, repo, *revs, **opts):
ui.status(_(b'nothing to split\n')) ui.status(_(b'nothing to split\n'))
return 1 return 1
if ctx.node() is None: if ctx.node() is None:
raise error.Abort(_(b'cannot split working directory')) raise error.InputError(_(b'cannot split working directory'))
if opts.get(b'rebase'): if opts.get(b'rebase'):
# Skip obsoleted descendants and their descendants so the rebase # Skip obsoleted descendants and their descendants so the rebase
...@@ -98,7 +98,7 @@ def split(ui, repo, *revs, **opts): ...@@ -98,7 +98,7 @@ def split(ui, repo, *revs, **opts):
rewriteutil.precheck(repo, [rev] + torebase, b'split') rewriteutil.precheck(repo, [rev] + torebase, b'split')
if len(ctx.parents()) > 1: if len(ctx.parents()) > 1:
raise error.Abort(_(b'cannot split a merge changeset')) raise error.InputError(_(b'cannot split a merge changeset'))
cmdutil.bailifchanged(repo) cmdutil.bailifchanged(repo)
...@@ -170,7 +170,7 @@ def dosplit(ui, repo, tr, ctx, opts): ...@@ -170,7 +170,7 @@ def dosplit(ui, repo, tr, ctx, opts):
committed.append(newctx) committed.append(newctx)
if not committed: if not committed:
raise error.Abort(_(b'cannot split an empty revision')) raise error.InputError(_(b'cannot split an empty revision'))
scmutil.cleanupnodes( scmutil.cleanupnodes(
repo, repo,
......
...@@ -51,7 +51,7 @@ Nothing to split ...@@ -51,7 +51,7 @@ Nothing to split
$ hg commit -m empty --config ui.allowemptycommit=1 $ hg commit -m empty --config ui.allowemptycommit=1
$ hg split $ hg split
abort: cannot split an empty revision abort: cannot split an empty revision
[255] [10]
$ rm -rf .hg $ rm -rf .hg
$ hg init $ hg init
...@@ -60,7 +60,7 @@ Cannot split working directory ...@@ -60,7 +60,7 @@ Cannot split working directory
$ hg split -r 'wdir()' $ hg split -r 'wdir()'
abort: cannot split working directory abort: cannot split working directory
[255] [10]
Generate some content. The sed filter drop CR on Windows, which is dropped in Generate some content. The sed filter drop CR on Windows, which is dropped in
the a > b line. the a > b line.
...@@ -103,7 +103,7 @@ Split a head ...@@ -103,7 +103,7 @@ Split a head
$ hg split 'all()' $ hg split 'all()'
abort: cannot split multiple revisions abort: cannot split multiple revisions
[255] [10]
This function splits a bit strangely primarily to avoid changing the behavior of This function splits a bit strangely primarily to avoid changing the behavior of
the test after a bug was fixed with how split/commit --interactive handled the test after a bug was fixed with how split/commit --interactive handled
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment