mercurial/commands.py
changeset 537 411e05b04ffa
parent 536 c15b4bc0a11c
child 547 4fc63e22b1fe
--- a/mercurial/commands.py	Thu Jun 30 20:54:01 2005 -0800
+++ b/mercurial/commands.py	Thu Jun 30 21:28:18 2005 -0800
@@ -32,19 +32,24 @@
         return [ util.pconvert(os.path.normpath(os.path.join(p, x))) for x in args ]
     return args
 
-def dodiff(ui, repo, path, files = None, node1 = None, node2 = None):
+def dodiff(ui, repo, files = None, node1 = None, node2 = None):
     def date(c):
         return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
 
+    (c, a, d, u) = repo.changes(None, node1, files)
+    if files:
+        c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
+
+    if not c and not a and not d:
+        return
+
     if node2:
         change = repo.changelog.read(node2)
         mmap2 = repo.manifest.read(change[0])
-        (c, a, d, u) = repo.changes(node1, node2)
         def read(f): return repo.file(f).read(mmap2[f])
         date2 = date(change)
     else:
         date2 = time.asctime()
-        (c, a, d, u) = repo.changes(None, node1, path)
         if not node1:
             node1 = repo.dirstate.parents()[0]
         def read(f): return repo.wfile(f).read()
@@ -59,9 +64,6 @@
     mmap = repo.manifest.read(change[0])
     date1 = date(change)
 
-    if files:
-        c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
-
     for f in c:
         to = None
         if f in mmap:
@@ -411,7 +413,7 @@
     else:
         files = relpath(repo, [""])
 
-    dodiff(ui, repo, os.getcwd(), files, *revs)
+    dodiff(ui, repo, files, *revs)
 
 def export(ui, repo, changeset):
     """dump the changeset header and diffs for a revision"""
@@ -428,7 +430,7 @@
     print change[4].rstrip()
     print
 
-    dodiff(ui, repo, "", None, prev, node)
+    dodiff(ui, repo, None, prev, node)
 
 def forget(ui, repo, file, *files):
     """don't add the specified files on the next commit"""
@@ -645,7 +647,7 @@
     R = removed
     ? = not tracked'''
 
-    (c, a, d, u) = repo.changes(None, None, os.getcwd())
+    (c, a, d, u) = repo.changes(None, None)
     (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
 
     for f in c: print "C", f