changeset 6602:a57a27b12965

match: remove files argument from patch.diff
author Matt Mackall <mpm@selenic.com>
date Mon, 12 May 2008 11:37:08 -0500
parents cab3ad865444
children 41eb20cc1c02
files hgext/hgk.py hgext/keyword.py hgext/mq.py hgext/record.py mercurial/commands.py mercurial/patch.py
diffstat 6 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/hgk.py	Mon May 12 11:37:08 2008 -0500
+++ b/hgext/hgk.py	Mon May 12 11:37:08 2008 -0500
@@ -94,7 +94,7 @@
             if opts['pretty']:
                 catcommit(ui, repo, node2, "")
             m = cmdutil.matchfiles(repo, files)
-            patch.diff(repo, node1, node2, files=m.files(), match=m,
+            patch.diff(repo, node1, node2, match=m,
                        opts=patch.diffopts(ui, {'git': True}))
         else:
             __difftree(repo, node1, node2, files=files)
--- a/hgext/keyword.py	Mon May 12 11:37:08 2008 -0500
+++ b/hgext/keyword.py	Mon May 12 11:37:08 2008 -0500
@@ -503,7 +503,7 @@
         # shrink keywords read from working dir
         self.lines = kwt.shrinklines(self.fname, self.lines)
 
-    def kw_diff(repo, node1=None, node2=None, files=None, match=util.always,
+    def kw_diff(repo, node1=None, node2=None, match=None,
                 fp=None, changes=None, opts=None):
         '''Monkeypatch patch.diff to avoid expansion except when
         comparing against working dir.'''
@@ -511,7 +511,7 @@
             kwt.matcher = util.never
         elif node1 is not None and node1 != repo.changectx().node():
             kwt.restrict = True
-        patch_diff(repo, node1, node2, files, match, fp, changes, opts)
+        patch_diff(repo, node1, node2, match, fp, changes, opts)
 
     def kwweb_changeset(web, req, tmpl):
         '''Wraps webcommands.changeset turning off keyword expansion.'''
--- a/hgext/mq.py	Mon May 12 11:37:08 2008 -0500
+++ b/hgext/mq.py	Mon May 12 11:37:08 2008 -0500
@@ -321,8 +321,7 @@
     def printdiff(self, repo, node1, node2=None, files=None,
                   fp=None, changes=None, opts={}):
         m = cmdutil.match(repo, files, opts)
-        patch.diff(repo, node1, node2, m.files(), match=m,
-                   fp=fp, changes=changes, opts=self.diffopts())
+        patch.diff(repo, node1, node2, m, fp, changes, self.diffopts())
 
     def mergeone(self, repo, mergeq, head, patch, rev):
         # first try just applying the patch
@@ -1083,7 +1082,7 @@
                 a = util.unique(aa)
                 c = [filter(matchfn, l) for l in (m, a, r, [], u)]
                 match = cmdutil.matchfiles(repo, util.unique(c[0] + c[1] + c[2]))
-                patch.diff(repo, patchparent, files=match.files(), match=match,
+                patch.diff(repo, patchparent, match=match,
                            fp=patchf, changes=c, opts=self.diffopts())
                 patchf.close()
 
--- a/hgext/record.py	Mon May 12 11:37:08 2008 -0500
+++ b/hgext/record.py	Mon May 12 11:37:08 2008 -0500
@@ -410,8 +410,8 @@
             match = cmdutil.matchfiles(repo, modified + added + removed)
         diffopts = mdiff.diffopts(git=True, nodates=True)
         fp = cStringIO.StringIO()
-        patch.diff(repo, repo.dirstate.parents()[0], files=match.files(),
-                   match=match, changes=changes, opts=diffopts, fp=fp)
+        patch.diff(repo, repo.dirstate.parents()[0], match=match,
+                   changes=changes, opts=diffopts, fp=fp)
         fp.seek(0)
 
         # 1. filter patch, so we have intending-to apply subset of it
--- a/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/commands.py	Mon May 12 11:37:08 2008 -0500
@@ -961,8 +961,7 @@
     node1, node2 = cmdutil.revpair(repo, opts['rev'])
 
     m = cmdutil.match(repo, pats, opts)
-    patch.diff(repo, node1, node2, m.files(), match=m,
-               opts=patch.diffopts(ui, opts))
+    patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts))
 
 def export(ui, repo, *changesets, **opts):
     """dump the header and diffs for one or more changesets
--- a/mercurial/patch.py	Mon May 12 11:37:08 2008 -0500
+++ b/mercurial/patch.py	Mon May 12 11:37:08 2008 -0500
@@ -1152,7 +1152,7 @@
     ret.append('\n')
     return ''.join(ret)
 
-def diff(repo, node1=None, node2=None, files=None, match=util.always,
+def diff(repo, node1=None, node2=None, match=None,
          fp=None, changes=None, opts=None):
     '''print diff of changes to files between two nodes, or node and
     working directory.
@@ -1160,6 +1160,9 @@
     if node1 is None, use first dirstate parent instead.
     if node2 is None, compare node1 with working directory.'''
 
+    if not match:
+        match = cmdutil.matchall(repo)
+
     if opts is None:
         opts = mdiff.defaultopts
     if fp is None:
@@ -1183,7 +1186,7 @@
     date1 = util.datestr(ctx1.date())
 
     if not changes:
-        changes = repo.status(node1, node2, files, match=match)[:5]
+        changes = repo.status(node1, node2, files=match.files(), match=match)[:5]
     modified, added, removed, deleted, unknown = changes
 
     if not modified and not added and not removed: