D9383: errors: raise InputError on bad repo arguments

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Nov 24 18:07:39 UTC 2020


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

REVISION SUMMARY
  I'm not sure if one of these should be StateError...

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-alias.t
  tests/test-dispatch.t
  tests/test-globalopts.t
  tests/test-i18n.t
  tests/test-update-branches.t

CHANGE DETAILS

diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -58,7 +58,7 @@
   $ cd ..
   $ hg update b1
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
   $ cd b1
 
 Test helper functions:
diff --git a/tests/test-i18n.t b/tests/test-i18n.t
--- a/tests/test-i18n.t
+++ b/tests/test-i18n.t
@@ -9,19 +9,19 @@
 
   $ LANGUAGE=pt_BR hg tip
   abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)
-  [255]
+  [10]
 
 Using a more accommodating encoding:
 
   $ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
   abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado) (esc)
-  [255]
+  [10]
 
 Different encoding:
 
   $ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
   abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado) (esc)
-  [255]
+  [10]
 
 #endif
 
diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t
--- a/tests/test-globalopts.t
+++ b/tests/test-globalopts.t
@@ -86,14 +86,14 @@
   0: a
   $ hg ann a/a b/b
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
   $ hg -R b ann a/a
   abort: a/a not under root '$TESTTMP/b'
   (consider using '--cwd b')
   [255]
   $ hg log
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
 
 #endif
 
diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -198,7 +198,7 @@
 
   $ hg cat
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
 
 #endif
 
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -715,8 +715,8 @@
 #if no-outer-repo
   $ hg root
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
   $ hg --config alias.hgroot='!hg root' hgroot
   abort: no repository found in '$TESTTMP' (.hg not found)
-  [255]
+  [10]
 #endif
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1174,7 +1174,7 @@
                         intents=func.intents,
                     )
                     if not repo.local():
-                        raise error.Abort(
+                        raise error.InputError(
                             _(b"repository '%s' is not local") % path
                         )
                     repo.ui.setconfig(
@@ -1195,7 +1195,7 @@
                                 req.earlyoptions[b'repository'] = guess
                                 return _dispatch(req)
                         if not path:
-                            raise error.RepoError(
+                            raise error.InputError(
                                 _(
                                     b"no repository found in"
                                     b" '%s' (.hg not found)"



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


More information about the Mercurial-devel mailing list