changeset 779:b3c7cb74d325

Add paths command The following patch adds the 'paths' commands to show a named path, or list of available paths. In case anyone find it useful.
author TK Soh <teekaysoh@yahoo.com>
date Wed, 27 Jul 2005 08:19:59 -0800
parents d09975474928
children 5cb8a3a023b2
files mercurial/commands.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jul 27 08:14:52 2005 -0800
+++ b/mercurial/commands.py	Wed Jul 27 08:19:59 2005 -0800
@@ -777,6 +777,19 @@
         if n != hg.nullid:
             show_changeset(ui, repo, changenode=n)
 
+def paths(ui, repo, search = None):
+    """show path or list of available paths"""
+    if search:
+        for name, path in ui.configitems("paths"):
+            if name == search:
+                ui.write("%s\n" % path)
+                return
+        ui.warn("not found!\n")
+        return 1
+    else:
+        for name, path in ui.configitems("paths"):
+            ui.write("%s = %s\n" % (name, path))
+
 def pull(ui, repo, source="default", **opts):
     """pull changes from the specified source"""
     source = ui.expandpath(source)
@@ -1165,6 +1178,7 @@
          'hg log [-r REV1 [-r REV2]] [-p] [FILE]'),
     "manifest": (manifest, [], 'hg manifest [REV]'),
     "parents": (parents, [], 'hg parents [REV]'),
+    "paths": (paths, [], 'hg paths [name]'),
     "^pull":
         (pull,
          [('u', 'update', None, 'update working directory')],