Pull from hg://edge2.net/hg/cmds
authormpm@selenic.com
Wed, 18 May 2005 17:29:10 -0800
changeset 104 20b3e7aad499
parent 102 58039eddbdda (current diff)
parent 103 33500fe7d56c (diff)
child 105 6eeb50050486
Pull from hg://edge2.net/hg/cmds
hg
--- a/hg	Wed May 18 17:06:07 2005 -0800
+++ b/hg	Wed May 18 17:29:10 2005 -0800
@@ -119,6 +119,10 @@
         ui.warn("Unable to open repository\n")
         sys.exit(0)
 
+relpath = None
+if os.getcwd() != repo.root:
+    relpath = os.getcwd()[len(repo.root) + 1: ]
+
 if cmd == "checkout" or cmd == "co":
     node = repo.changelog.tip()
     if args:
@@ -177,9 +181,12 @@
 
 elif cmd == "status":
     (c, a, d) = repo.diffdir(repo.root, repo.current)
-    for f in c: ui.status("C %s\n" % f)
-    for f in a: ui.status("? %s\n" % f)
-    for f in d: ui.status("R %s\n" % f)
+    if relpath:
+        (c, a, d) = map(lambda x: filterfiles(x, [ relpath ]), (c, a, d))
+
+    for f in c: print "C", f
+    for f in a: print "?", f
+    for f in d: print "R", f
 
 elif cmd == "diff":
     revs = []
@@ -195,8 +202,7 @@
         self.ui.warn("too many revisions to diff\n")
         sys.exit(1)
 
-    if os.getcwd() != repo.root:
-        relpath = os.getcwd()[len(repo.root) + 1: ]
+    if relpath:
         if not args: args = [ relpath ]
         else: args = [ os.path.join(relpath, x) for x in args ]
 
@@ -296,7 +302,11 @@
     ui.status("%d:%s\n" % (t, hg.hex(n)))
 
 elif cmd == "log":
-    if args:
+
+    if len(args) == 1:
+        if relpath:
+            args[0] = os.path.join(relpath, args[0])
+
         r = repo.file(args[0])
         for i in range(r.count()):
             n = r.node(i)
@@ -309,6 +319,14 @@
             print "changeset: %4d:%s" % (cr, cn)
             print "parents:   %4d:%s" % (i1, h1)
             if i2: print "           %4d:%s" % (i2, h2)
+            changes = repo.changelog.read(repo.changelog.node(cr))
+            print "user: %s    date: %s" % (changes[1], time.asctime(
+                    time.localtime(float(changes[2].split(' ')[0]))))
+            print "description:"
+            print changes[4]
+            print
+    elif len(args) > 1:
+        print "too many args"
     else:
         print "missing filename"