changeset 46977:3f87d2af0bd6

errors: raise RemoteError in some places in exchange.py This is part of https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan Differential Revision: https://phab.mercurial-scm.org/D10467
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Apr 2021 12:52:23 -0700
parents f9482db16cef
children dc8976cc3a6e
files mercurial/exchange.py tests/test-bookmarks-pushpull.t tests/test-bundle2-exchange.t tests/test-bundle2-remote-changegroup.t tests/test-clone-uncompressed.t tests/test-http.t tests/test-lfs-serve.t tests/test-narrow-clone-stream.t tests/test-narrow-pull.t tests/test-narrow-shallow.t tests/test-remotefilelog-clone-tree.t tests/test-remotefilelog-clone.t tests/test-ssh.t
diffstat 13 files changed, 35 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Mon Apr 19 09:37:01 2021 -0700
+++ b/mercurial/exchange.py	Mon Apr 19 12:52:23 2021 -0700
@@ -1147,19 +1147,19 @@
                     },
                 ).result()
         except error.BundleValueError as exc:
-            raise error.Abort(_(b'missing support for %s') % exc)
+            raise error.RemoteError(_(b'missing support for %s') % exc)
         try:
             trgetter = None
             if pushback:
                 trgetter = pushop.trmanager.transaction
             op = bundle2.processbundle(pushop.repo, reply, trgetter)
         except error.BundleValueError as exc:
-            raise error.Abort(_(b'missing support for %s') % exc)
+            raise error.RemoteError(_(b'missing support for %s') % exc)
         except bundle2.AbortFromPart as exc:
             pushop.ui.error(_(b'remote: %s\n') % exc)
             if exc.hint is not None:
                 pushop.ui.error(_(b'remote: %s\n') % (b'(%s)' % exc.hint))
-            raise error.Abort(_(b'push failed on remote'))
+            raise error.RemoteError(_(b'push failed on remote'))
     except error.PushkeyFailed as exc:
         partid = int(exc.partid)
         if partid not in pushop.pkfailcb:
@@ -1875,9 +1875,9 @@
             bundle2.processbundle(pullop.repo, bundle, op=op)
         except bundle2.AbortFromPart as exc:
             pullop.repo.ui.error(_(b'remote: abort: %s\n') % exc)
-            raise error.Abort(_(b'pull failed on remote'), hint=exc.hint)
+            raise error.RemoteError(_(b'pull failed on remote'), hint=exc.hint)
         except error.BundleValueError as exc:
-            raise error.Abort(_(b'missing support for %s') % exc)
+            raise error.RemoteError(_(b'missing support for %s') % exc)
 
     if pullop.fetch:
         pullop.cgresult = bundle2.combinechangegroupresults(op)
--- a/tests/test-bookmarks-pushpull.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-bookmarks-pushpull.t	Mon Apr 19 12:52:23 2021 -0700
@@ -1217,7 +1217,7 @@
   no changes found
   remote: prepushkey hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
 #endif
 
@@ -1257,7 +1257,7 @@
   no changes found
   remote: prepushkey hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
 #endif
 
@@ -1334,7 +1334,7 @@
   no changes found
   remote: prepushkey.no-bm-move hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 #endif
 
 -- test for pushing bookmarks pointing to secret changesets
--- a/tests/test-bundle2-exchange.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-bundle2-exchange.t	Mon Apr 19 12:52:23 2021 -0700
@@ -548,7 +548,7 @@
   remote: Abandon ship!
   remote: (don't panic)
   abort: push failed on remote
-  [255]
+  [100]
 
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
@@ -556,7 +556,7 @@
   remote: Abandon ship!
   remote: (don't panic)
   abort: push failed on remote
-  [255]
+  [100]
 
 
 Doing the actual push: unknown mandatory parts
@@ -570,19 +570,19 @@
   pushing to other
   searching for changes
   abort: missing support for test:unknown
-  [255]
+  [100]
 
   $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
   pushing to ssh://user@dummy/other
   searching for changes
   abort: missing support for test:unknown
-  [255]
+  [100]
 
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
   searching for changes
   abort: missing support for test:unknown
-  [255]
+  [100]
 
 Doing the actual push: race
 
@@ -653,7 +653,7 @@
   remote: rollback completed
   remote: pretxnclose.failpush hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
@@ -668,7 +668,7 @@
   remote: rollback completed
   remote: pretxnclose.failpush hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
 (check that no 'pending' files remain)
 
@@ -712,7 +712,7 @@
   remote: rollback completed
   remote: pretxnchangegroup hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
   searching for changes
@@ -725,7 +725,7 @@
   remote: rollback completed
   remote: pretxnchangegroup hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
 Check output capture control.
 
@@ -760,7 +760,7 @@
   remote: rollback completed
   remote: pretxnchangegroup hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
   $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
   pushing to http://localhost:$HGPORT2/
   searching for changes
@@ -773,7 +773,7 @@
   remote: rollback completed
   remote: pretxnchangegroup hook exited with status 1
   abort: push failed on remote
-  [255]
+  [100]
 
 Check abort from mandatory pushkey
 
@@ -950,7 +950,7 @@
   searching for changes
   remote: Lock should not be taken
   abort: push failed on remote
-  [255]
+  [100]
 
   $ cat >> ../lazylock/.hg/hgrc <<EOF
   > [experimental]
--- a/tests/test-bundle2-remote-changegroup.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-bundle2-remote-changegroup.t	Mon Apr 19 12:52:23 2021 -0700
@@ -542,7 +542,7 @@
   searching for changes
   remote: remote-changegroup
   abort: missing support for remote-changegroup - digest:foo
-  [255]
+  [100]
 
 Missing digest
 
--- a/tests/test-clone-uncompressed.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-clone-uncompressed.t	Mon Apr 19 12:52:23 2021 -0700
@@ -408,7 +408,7 @@
   remote: abort: server has pull-based clones disabled
   abort: pull failed on remote
   (remove --pull if specified or upgrade Mercurial)
-  [255]
+  [100]
 
 Local stream clone with secrets involved
 (This is just a test over behavior: if you have access to the repo's files,
@@ -629,7 +629,7 @@
   streaming all changes
   remote: abort: server has obsolescence markers, but client cannot receive them via stream clone
   abort: pull failed on remote
-  [255]
+  [100]
 
   $ killdaemons.py
 
--- a/tests/test-http.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-http.t	Mon Apr 19 12:52:23 2021 -0700
@@ -505,7 +505,7 @@
   requesting all changes
   remote: abort: this is an exercise
   abort: pull failed on remote
-  [255]
+  [100]
   $ cat error.log
 
 disable pull-based clones
@@ -517,7 +517,7 @@
   remote: abort: server has pull-based clones disabled
   abort: pull failed on remote
   (remove --pull if specified or upgrade Mercurial)
-  [255]
+  [100]
 
 #if no-reposimplestore
 ... but keep stream clones working
--- a/tests/test-lfs-serve.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-lfs-serve.t	Mon Apr 19 12:52:23 2021 -0700
@@ -293,7 +293,7 @@
   requesting all changes
   remote: abort: no common changegroup version
   abort: pull failed on remote
-  [255]
+  [100]
   $ grep 'lfs' $TESTTMP/client4_pull/.hg/requires $SERVER_REQUIRES
   $TESTTMP/server/.hg/requires:lfs
 
--- a/tests/test-narrow-clone-stream.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-narrow-clone-stream.t	Mon Apr 19 12:52:23 2021 -0700
@@ -39,7 +39,7 @@
   streaming all changes
   remote: abort: server does not support narrow stream clones
   abort: pull failed on remote
-  [255]
+  [100]
 
 Enable stream clone on the server
 
--- a/tests/test-narrow-pull.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-narrow-pull.t	Mon Apr 19 12:52:23 2021 -0700
@@ -151,4 +151,4 @@
   transaction abort!
   rollback completed
   abort: pull failed on remote
-  [255]
+  [100]
--- a/tests/test-narrow-shallow.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-narrow-shallow.t	Mon Apr 19 12:52:23 2021 -0700
@@ -110,9 +110,9 @@
   requesting all changes
   remote: abort: depth must be positive, got 0
   abort: pull failed on remote
-  [255]
+  [100]
   $ hg clone --narrow ssh://user@dummy/master bad --include "d2" --depth -1
   requesting all changes
   remote: abort: depth must be positive, got -1
   abort: pull failed on remote
-  [255]
+  [100]
--- a/tests/test-remotefilelog-clone-tree.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-remotefilelog-clone-tree.t	Mon Apr 19 12:52:23 2021 -0700
@@ -95,7 +95,7 @@
 #   flakiness here
   $ hg clone --noupdate ssh://user@dummy/shallow full 2>/dev/null
   streaming all changes
-  [255]
+  [100]
 
 # getbundle full clone
 
--- a/tests/test-remotefilelog-clone.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-remotefilelog-clone.t	Mon Apr 19 12:52:23 2021 -0700
@@ -89,7 +89,7 @@
   $ TEMP_STDERR=full-clone-from-shallow.stderr.tmp
   $ hg clone --noupdate ssh://user@dummy/shallow full 2>$TEMP_STDERR
   streaming all changes
-  [255]
+  [100]
   $ cat $TEMP_STDERR
   remote: abort: Cannot clone from a shallow repo to a full repo.
   abort: pull failed on remote
--- a/tests/test-ssh.t	Mon Apr 19 09:37:01 2021 -0700
+++ b/tests/test-ssh.t	Mon Apr 19 12:52:23 2021 -0700
@@ -487,7 +487,7 @@
   remote: Permission denied
   remote: pretxnopen.hg-ssh hook failed
   abort: push failed on remote
-  [255]
+  [100]
 
   $ cd $TESTTMP
 
@@ -681,7 +681,7 @@
   remote: rollback completed
   remote: pretxnchangegroup.fail hook failed
   abort: push failed on remote
-  [255]
+  [100]
 
 abort during pull is properly reported as such
 
@@ -696,7 +696,7 @@
   searching for changes
   remote: abort: this is an exercise
   abort: pull failed on remote
-  [255]
+  [100]
 
 abort with no error hint when there is a ssh problem when pulling