exchange: don't print error codes after clone bundle failure
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 15 Oct 2015 14:53:32 -0700
changeset 26732 69ac9aebbc55
parent 26731 0c42b6bb2329
child 26733 f6e2e42fb8ef
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.
mercurial/exchange.py
tests/test-clonebundles.t
--- a/mercurial/exchange.py	Wed Oct 14 14:53:15 2015 -0400
+++ b/mercurial/exchange.py	Thu Oct 15 14:53:32 2015 -0700
@@ -1795,7 +1795,7 @@
             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:
--- a/tests/test-clonebundles.t	Wed Oct 14 14:53:15 2015 -0400
+++ b/tests/test-clonebundles.t	Thu Oct 15 14:53:32 2015 -0700
@@ -80,7 +80,7 @@
   $ 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]
@@ -90,7 +90,7 @@
   $ 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]