Document diff in help
authormpm@selenic.com
Wed, 04 May 2005 17:26:27 -0800
changeset 22 40b8c158c540
parent 21 54a57a5ebcb1
child 23 018fb8d9ea8d
Document diff in help Add filenames to diff support
hg
--- a/hg	Wed May 04 17:19:02 2005 -0800
+++ b/hg	Wed May 04 17:26:27 2005 -0800
@@ -35,6 +35,7 @@
  log <file>            show revision history of a single file
  dump <file> [rev]     dump the latest or given revision of a file
  dumpmanifest [rev]    dump the latest or given revision of the manifest
+ diff [files...]       diff working directory (or selected files)
 """
 
 options = {}
@@ -123,6 +124,19 @@
         mmap = repo.manifest.read(change[0])
 
     (c, a, d) = repo.diffdir(repo.root)
+
+    if args:
+        nc = [ x for x in c if x in args ]
+        na = [ x for x in a if x in args ]
+        nd = [ x for x in d if x in args ]
+        for arg in args:
+            if not os.path.isdir(arg): continue
+            if arg[-1] != os.sep: arg += os.sep
+            nc += [ x for x in c if x.startswith(arg) ]
+            na += [ x for x in a if x.startswith(arg) ]
+            nd += [ x for x in d if x.startswith(arg) ]
+        (c, a, d) = (nc, na, nd)
+
     for f in c:
         to = repo.file(f).read(mmap[f])
         tn = file(f).read()