changeset 47276:9cc9b4a25248

urlutil: provide some information about "bad url" when processing `pushurl` It appears pushurl only support `<proto>://` entries. This is not obvious and can lead to obscure error. We make the error less obscure as a start.. Differential Revision: https://phab.mercurial-scm.org/D10455
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 16 Apr 2021 00:16:43 +0200
parents ba673c821b9d
children ed0d54b20c5b
files mercurial/utils/urlutil.py tests/test-paths.t
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/utils/urlutil.py	Sun Apr 11 19:19:34 2021 +0200
+++ b/mercurial/utils/urlutil.py	Fri Apr 16 00:16:43 2021 +0200
@@ -742,7 +742,9 @@
     u = url(value)
     # Actually require a URL.
     if not u.scheme:
-        ui.warn(_(b'(paths.%s:pushurl not a URL; ignoring)\n') % path.name)
+        msg = _(b'(paths.%s:pushurl not a URL; ignoring: "%s")\n')
+        msg %= (path.name, value)
+        ui.warn(msg)
         return None
 
     # Don't support the #foo syntax in the push URL to declare branch to
--- a/tests/test-paths.t	Sun Apr 11 19:19:34 2021 +0200
+++ b/tests/test-paths.t	Fri Apr 16 00:16:43 2021 +0200
@@ -175,7 +175,7 @@
   > EOF
 
   $ hg paths
-  (paths.default:pushurl not a URL; ignoring)
+  (paths.default:pushurl not a URL; ignoring: "/not/a/url")
   default = /path/to/nothing
 
 #fragment is not allowed in :pushurl