changeset 175:0eb6e2c9800d

hg: remove some debug commands, improve help messages, add .hgpaths file .hgpaths is a file with lines of the form: <symbolic name> <repository path or url> that allows you to do: hg merge <name>
author mpm@selenic.com
date Thu, 26 May 2005 23:39:42 -0800
parents 23057dc57d1b
children 1d8e9637a0a4 91055f795d88
files hg
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hg	Thu May 26 22:54:48 2005 -0800
+++ b/hg	Thu May 26 23:39:42 2005 -0800
@@ -20,7 +20,7 @@
 from mercurial import hg, mdiff, fancyopts
 
 def help():
-    print """\
+    ui.status("""\
  commands:
 
  add [files...]        add the given files in the next commit
@@ -42,7 +42,7 @@
  status                show new, missing, and changed files in working dir
  tags                  show current changeset tags
  undo                  undo the last transaction
-"""
+""")
 
 def filterfiles(list, files):
     l = [ x for x in list if x in files ]
@@ -372,13 +372,6 @@
     for f in files:
         print hg.hex(m[f]), f
 
-elif cmd == "debugprompt":
-    print ui.prompt(args[0], args[1], args[2])
-
-elif cmd == "debughash":
-    f = repo.file(args[0])
-    print f.encodepath(args[0])
-
 elif cmd == "debugindex":
     if ".hg" not in args[0]:
         args[0] = ".hg/data/" + repo.file(args[0]).encodepath(args[0]) + "i"
@@ -412,6 +405,17 @@
         sys.exit(1)
 
     if args:
+        paths = {}
+        try:
+            pf = os.path.join(os.environ["HOME"], ".hgpaths")
+            for l in file(pf):
+                name, path = l.split()
+                paths[name] = path
+        except:
+            pass
+
+        if args[0] in paths: args[0] = paths[args[0]]
+        
         other = hg.repository(ui, args[0])
         ui.status("requesting changegroup\n")
         cg = repo.getchangegroup(other)
@@ -580,6 +584,6 @@
                  soptions["address"], soptions["port"])
     
 else:
-    print "unknown command\n"
+    if cmd: ui.warn("unknown command\n\n")
     help()
     sys.exit(1)