Patchwork [2,of,9,paths,v2] commands.paths: use ui.paths to show paths

login
register
mail settings
Submitter Gregory Szorc
Date March 1, 2015, 9:50 p.m.
Message ID <4ac2f2aba635e6a1db1a.1425246641@vm-ubuntu-main.gateway.sonic.net>
Download mbox | patch
Permalink /patch/7863/
State Superseded
Commit a330660b3d71da0adbb4508c32e64e31feeb18f1
Headers show

Comments

Gregory Szorc - March 1, 2015, 9:50 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1423342170 28800
#      Sat Feb 07 12:49:30 2015 -0800
# Node ID 4ac2f2aba635e6a1db1a2ddd0dd02ca1b1f5ecc6
# Parent  c458cf1a414e2d1534841fd55274678e93c8c707
commands.paths: use ui.paths to show paths

We now have an API for representing a collection of paths. Use it.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4820,21 +4820,22 @@  def paths(ui, repo, search=None):
 
     Returns 0 on success.
     """
     if search:
-        for name, path in ui.configitems("paths"):
-            if name == search:
-                ui.status("%s\n" % util.hidepassword(path))
+        for path in ui.paths:
+            if path.name == search:
+                ui.status("%s\n" % util.hidepassword(path.loc))
                 return
         if not ui.quiet:
             ui.warn(_("not found!\n"))
         return 1
     else:
-        for name, path in ui.configitems("paths"):
+        for path in ui.paths:
             if ui.quiet:
-                ui.write("%s\n" % name)
+                ui.write("%s\n" % path.name)
             else:
-                ui.write("%s = %s\n" % (name, util.hidepassword(path)))
+                ui.write("%s = %s\n" % (path.name,
+                                        util.hidepassword(path.loc)))
 
 @command('phase',
     [('p', 'public', False, _('set changeset phase to public')),
      ('d', 'draft', False, _('set changeset phase to draft')),