D9329: errors: use InputError for some errors on `hg clone`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Nov 17 00:28:57 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/D9329

AFFECTED FILES
  mercurial/hg.py
  tests/test-bundle.t
  tests/test-clone.t
  tests/test-http-clone-r.t
  tests/test-ssh-bundle1.t
  tests/test-ssh.t

CHANGE DETAILS

diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -387,7 +387,7 @@
   $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
   destination directory: a repo
   abort: destination 'a repo' is not empty
-  [255]
+  [10]
 
 Make sure hg is really paranoid in serve --stdio mode. It used to be
 possible to get a debugger REPL by specifying a repo named --debugger.
diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -367,7 +367,7 @@
   $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
   destination directory: a repo
   abort: destination 'a repo' is not empty
-  [255]
+  [10]
 
 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
diff --git a/tests/test-http-clone-r.t b/tests/test-http-clone-r.t
--- a/tests/test-http-clone-r.t
+++ b/tests/test-http-clone-r.t
@@ -217,6 +217,6 @@
 
   $ hg clone http://localhost:$HGPORT/
   abort: empty destination path is not valid
-  [255]
+  [10]
 
   $ cat error.log
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -73,7 +73,7 @@
 
   $ hg clone . ''
   abort: empty destination path is not valid
-  [255]
+  [10]
 
 No update, with debug option:
 
@@ -189,7 +189,7 @@
 
   $ hg clone --pull a ''
   abort: empty destination path is not valid
-  [255]
+  [10]
 
 Clone to '.':
 
@@ -676,7 +676,7 @@
   $ hg clone q
   destination directory: q
   abort: destination 'q' is not empty
-  [255]
+  [10]
 
 destination directory not empty
 
@@ -684,7 +684,7 @@
   $ echo stuff > a/a
   $ hg clone q a
   abort: destination 'a' is not empty
-  [255]
+  [10]
 
 
 #if unix-permissions no-root
diff --git a/tests/test-bundle.t b/tests/test-bundle.t
--- a/tests/test-bundle.t
+++ b/tests/test-bundle.t
@@ -601,7 +601,7 @@
 
   $ hg clone full.hg ''
   abort: empty destination path is not valid
-  [255]
+  [10]
 
 test for https://bz.mercurial-scm.org/216
 
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -683,14 +683,14 @@
     source = util.urllocalpath(source)
 
     if not dest:
-        raise error.Abort(_(b"empty destination path is not valid"))
+        raise error.InputError(_(b"empty destination path is not valid"))
 
     destvfs = vfsmod.vfs(dest, expandpath=True)
     if destvfs.lexists():
         if not destvfs.isdir():
-            raise error.Abort(_(b"destination '%s' already exists") % dest)
+            raise error.InputError(_(b"destination '%s' already exists") % dest)
         elif destvfs.listdir():
-            raise error.Abort(_(b"destination '%s' is not empty") % dest)
+            raise error.InputError(_(b"destination '%s' is not empty") % dest)
 
     createopts = {}
     narrow = False



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


More information about the Mercurial-devel mailing list