[PATCH STABLE] paths: include #fragment again

Yuya Nishihara yuya at tcha.org
Mon Dec 7 14:32:40 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1449492170 -32400
#      Mon Dec 07 21:42:50 2015 +0900
# Branch stable
# Node ID f370cab20a1e1d8c7e982a92357220ef2edde379
# Parent  10695f8f3323e745a2603f6f2ff7d11956c58e7b
paths: include #fragment again

Since 5f2a4fc3c4fa, #fragment was missing in "hg paths" output because
path.loc was changed to a parsed URL. "hg paths" should use path.rawloc to
show complete URLs.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5110,7 +5110,7 @@ def paths(ui, repo, search=None):
     if search:
         for name, path in sorted(ui.paths.iteritems()):
             if name == search:
-                ui.status("%s\n" % util.hidepassword(path.loc))
+                ui.status("%s\n" % util.hidepassword(path.rawloc))
                 return
         if not ui.quiet:
             ui.warn(_("not found!\n"))
@@ -5121,7 +5121,7 @@ def paths(ui, repo, search=None):
                 ui.write("%s\n" % name)
             else:
                 ui.write("%s = %s\n" % (name,
-                                        util.hidepassword(path.loc)))
+                                        util.hidepassword(path.rawloc)))
 
 @command('phase',
     [('p', 'public', False, _('set changeset phase to public')),
diff --git a/tests/test-paths.t b/tests/test-paths.t
--- a/tests/test-paths.t
+++ b/tests/test-paths.t
@@ -4,7 +4,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd a
   $ echo '[paths]' >> .hg/hgrc
-  $ echo 'dupe = ../b' >> .hg/hgrc
+  $ echo 'dupe = ../b#tip' >> .hg/hgrc
   $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc
   $ hg in dupe
   comparing with $TESTTMP/b (glob)
@@ -17,25 +17,25 @@
   [1]
   $ cd a
   $ hg paths
-  dupe = $TESTTMP/b (glob)
+  dupe = $TESTTMP/b#tip (glob)
   expand = $TESTTMP/a/$SOMETHING/bar (glob)
   $ SOMETHING=foo hg paths
-  dupe = $TESTTMP/b (glob)
+  dupe = $TESTTMP/b#tip (glob)
   expand = $TESTTMP/a/foo/bar (glob)
 #if msys
   $ SOMETHING=//foo hg paths
-  dupe = $TESTTMP/b (glob)
+  dupe = $TESTTMP/b#tip (glob)
   expand = /foo/bar
 #else
   $ SOMETHING=/foo hg paths
-  dupe = $TESTTMP/b (glob)
+  dupe = $TESTTMP/b#tip (glob)
   expand = /foo/bar
 #endif
   $ hg paths -q
   dupe
   expand
   $ hg paths dupe
-  $TESTTMP/b (glob)
+  $TESTTMP/b#tip (glob)
   $ hg paths -q dupe
   $ hg paths unknown
   not found!


More information about the Mercurial-devel mailing list