Fix diff and export not showing added files
authormpm@selenic.com
Sat, 21 May 2005 17:03:12 -0800
changeset 129 1db9207def07
parent 128 d6afb6dbf9f2
child 130 e6678a1beb6a
Fix diff and export not showing added files
hg
--- a/hg	Sat May 21 13:14:58 2005 -0800
+++ b/hg	Sat May 21 17:03:12 2005 -0800
@@ -65,6 +65,7 @@
         if not node1:
             node1 = repo.current
         (c, a, d) = repo.diffdir(repo.root, node1)
+        a = [] # ignore unknown files in repo, by popular request
         def read(f): return file(os.path.join(repo.root, f)).read()
 
     change = repo.changelog.read(node1)
@@ -72,13 +73,16 @@
     date1 = date(change)
 
     if files:
-        c = filterfiles(c, files)
-        d = filterfiles(d, files)
+        c, a, d = map(lambda x: filterfiles(x, files), (c, a, d))
 
     for f in c:
         to = repo.file(f).read(mmap[f])
         tn = read(f)
         sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
+    for f in a:
+        to = ""
+        tn = read(f)
+        sys.stdout.write(mdiff.unidiff(to, date1, tn, date2, f))
     for f in d:
         to = repo.file(f).read(mmap[f])
         tn = ""