Patchwork D10467: errors: raise RemoteError in some places in exchange.py

login
register
mail settings
Submitter phabricator
Date April 19, 2021, 8:06 p.m.
Message ID <differential-rev-PHID-DREV-bvhcdlpbu6ysifb6edlq-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48784/
State Superseded
Headers show

Comments

phabricator - April 19, 2021, 8:06 p.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is part of https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED 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

CHANGE DETAILS




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

Patch

diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -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
 
diff --git a/tests/test-remotefilelog-clone.t b/tests/test-remotefilelog-clone.t
--- a/tests/test-remotefilelog-clone.t
+++ b/tests/test-remotefilelog-clone.t
@@ -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
diff --git a/tests/test-remotefilelog-clone-tree.t b/tests/test-remotefilelog-clone-tree.t
--- a/tests/test-remotefilelog-clone-tree.t
+++ b/tests/test-remotefilelog-clone-tree.t
@@ -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
 
diff --git a/tests/test-narrow-shallow.t b/tests/test-narrow-shallow.t
--- a/tests/test-narrow-shallow.t
+++ b/tests/test-narrow-shallow.t
@@ -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]
diff --git a/tests/test-narrow-pull.t b/tests/test-narrow-pull.t
--- a/tests/test-narrow-pull.t
+++ b/tests/test-narrow-pull.t
@@ -151,4 +151,4 @@ 
   transaction abort!
   rollback completed
   abort: pull failed on remote
-  [255]
+  [100]
diff --git a/tests/test-narrow-clone-stream.t b/tests/test-narrow-clone-stream.t
--- a/tests/test-narrow-clone-stream.t
+++ b/tests/test-narrow-clone-stream.t
@@ -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
 
diff --git a/tests/test-lfs-serve.t b/tests/test-lfs-serve.t
--- a/tests/test-lfs-serve.t
+++ b/tests/test-lfs-serve.t
@@ -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
 
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -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
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -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
 
diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t
--- a/tests/test-bundle2-remote-changegroup.t
+++ b/tests/test-bundle2-remote-changegroup.t
@@ -542,7 +542,7 @@ 
   searching for changes
   remote: remote-changegroup
   abort: missing support for remote-changegroup - digest:foo
-  [255]
+  [100]
 
 Missing digest
 
diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t
--- a/tests/test-bundle2-exchange.t
+++ b/tests/test-bundle2-exchange.t
@@ -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]
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -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
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -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)