Add paths command
authorTK Soh <teekaysoh@yahoo.com>
Wed, 27 Jul 2005 08:19:59 -0800
changeset 779 b3c7cb74d325
parent 778 d09975474928
child 780 5cb8a3a023b2
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.
mercurial/commands.py
--- 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')],