[patch 07/10] Add optional parameter for changed/added/del/unknown files to commands.dodiff

Chris Mason mason at suse.com
Tue Aug 9 12:43:00 CDT 2005


# HG changeset patch
# User mason at suse.com

Add optional parameter for changed/added/del/unknown files to commands.dodiff

This makes it possible to avoid a call into repo.changes if the details
of what has changed is already known

Index: mine/mercurial/commands.py
===================================================================
--- mine.orig/mercurial/commands.py	2005-08-05 12:10:43.000000000 -0400
+++ mine/mercurial/commands.py	2005-08-05 12:12:39.000000000 -0400
@@ -159,11 +159,14 @@ def make_file(repo, r, pat, node=None,
     return open(make_filename(repo, r, pat, node, total, seqno, revwidth),
                 mode)
 
-def dodiff(fp, ui, repo, files=None, node1=None, node2=None, match=util.always):
+def dodiff(fp, ui, repo, files=None, node1=None, node2=None, match=util.always, changes=None):
     def date(c):
         return time.asctime(time.gmtime(float(c[2].split(' ')[0])))
 
-    (c, a, d, u) = repo.changes(node1, node2, files, match = match)
+    if not changes:
+        (c, a, d, u) = repo.changes(node1, node2, files, match = match)
+    else:
+        (c, a, d, u) = changes
     if files:
         c, a, d = map(lambda x: filterfiles(files, x), (c, a, d))
 

--


More information about the Mercurial mailing list