changeset 104:20b3e7aad499

Pull from hg://edge2.net/hg/cmds
author mpm@selenic.com
date Wed, 18 May 2005 17:29:10 -0800
parents 58039eddbdda (current diff) 33500fe7d56c (diff)
children 6eeb50050486
files hg
diffstat 1 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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"