D9338: errors: raise InputError in `hg split`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Nov 18 00:56:53 UTC 2020


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9338

AFFECTED FILES
  hgext/split.py
  tests/test-split.t

CHANGE DETAILS

diff --git a/tests/test-split.t b/tests/test-split.t
--- a/tests/test-split.t
+++ b/tests/test-split.t
@@ -51,7 +51,7 @@
   $ hg commit -m empty --config ui.allowemptycommit=1
   $ hg split
   abort: cannot split an empty revision
-  [255]
+  [10]
 
   $ rm -rf .hg
   $ hg init
@@ -60,7 +60,7 @@
 
   $ hg split -r 'wdir()'
   abort: cannot split working directory
-  [255]
+  [10]
 
 Generate some content.  The sed filter drop CR on Windows, which is dropped in
 the a > b line.
@@ -103,7 +103,7 @@
 
   $ hg split 'all()'
   abort: cannot split multiple revisions
-  [255]
+  [10]
 
 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
diff --git a/hgext/split.py b/hgext/split.py
--- a/hgext/split.py
+++ b/hgext/split.py
@@ -72,7 +72,7 @@
     with repo.wlock(), repo.lock(), repo.transaction(b'split') as tr:
         revs = scmutil.revrange(repo, revlist or [b'.'])
         if len(revs) > 1:
-            raise error.Abort(_(b'cannot split multiple revisions'))
+            raise error.InputError(_(b'cannot split multiple revisions'))
 
         rev = revs.first()
         ctx = repo[rev]
@@ -82,7 +82,7 @@
             ui.status(_(b'nothing to split\n'))
             return 1
         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'):
             # Skip obsoleted descendants and their descendants so the rebase
@@ -98,7 +98,7 @@
         rewriteutil.precheck(repo, [rev] + torebase, b'split')
 
         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)
 
@@ -165,7 +165,7 @@
         committed.append(newctx)
 
     if not committed:
-        raise error.Abort(_(b'cannot split an empty revision'))
+        raise error.InputError(_(b'cannot split an empty revision'))
 
     scmutil.cleanupnodes(
         repo,



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list