[PATCH] exchange: don't print error codes after clone bundle failure

Gregory Szorc gregory.szorc at gmail.com
Thu Oct 15 21:54:16 UTC 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1444946012 25200
#      Thu Oct 15 14:53:32 2015 -0700
# Node ID 75a836db78f8a11584fe064ffb8d98985f752608
# Parent  83b738235f1bfc33a943a63a5d0f5527ac2da736
exchange: don't print error codes after clone bundle failure

We don't appear to print error codes elsewhere. The error codes are
inconsistent between at least Linux and OS X and are more trouble than
they are worth. Humans care about the error string more than the code
anyway.

A glob was also added to pave over differences in error strings between
Linux and OS X.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1790,9 +1790,9 @@ def trypullbundlefromurl(ui, repo, url):
                 return True
             except urllib2.HTTPError as e:
                 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))
             except urllib2.URLError as e:
-                ui.warn(_('error fetching bundle: %s\n') % e.reason)
+                ui.warn(_('error fetching bundle: %s\n') % e.reason[1])
 
             return False
         finally:
             tr.release()
diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -79,9 +79,9 @@ Manifest file with invalid URL aborts
 
   $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
   $ hg clone http://localhost:$HGPORT 404-url
   applying clone bundle from http://does.not.exist/bundle.hg
-  error fetching bundle: [Errno -2] Name or service not known
+  error fetching bundle: * not known (glob)
   abort: error applying bundle
   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
   [255]
 
@@ -89,9 +89,9 @@ Server is not running aborts
 
   $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
   $ hg clone http://localhost:$HGPORT server-not-runner
   applying clone bundle from http://localhost:$HGPORT1/bundle.hg
-  error fetching bundle: [Errno 111] Connection refused
+  error fetching bundle: Connection refused
   abort: error applying bundle
   (if this error persists, consider contacting the server operator or disable clone bundles via "--config experimental.clonebundles=false")
   [255]
 


More information about the Mercurial-devel mailing list