Patchwork D10455: urlutil: provide some information about "bad url" when processing `pushurl`

login
register
mail settings
Submitter phabricator
Date April 16, 2021, 12:56 a.m.
Message ID <differential-rev-PHID-DREV-2sbinm3ayggwgjzezljz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48772/
State New
Headers show

Comments

phabricator - April 16, 2021, 12:56 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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..

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/utils/urlutil.py
  tests/test-paths.t

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-paths.t b/tests/test-paths.t
--- a/tests/test-paths.t
+++ b/tests/test-paths.t
@@ -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
diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -740,7 +740,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