Steve Borho avatar Steve Borho committed b740366

changeset: provide filtered changes to patch.diff

The repo.status() call in patch.diff() was how the provided matcher was used
to build the list of files to be diffed. So now we directly filter the cached
repo.status() results and pass those to patch.diff()

Comments (0)

Files changed (1)

tortoisehg/hgtk/changeset.py

                     _(' %s is larger than the specified max diff size') % wfile]
         else:
             lines = []
-            m = cmdutil.matchfiles(self.repo, [wfile])
+            M, A, R = self.changes
+            if wfile in M:
+                changes = [wfile], [], []
+            elif wfile in A:
+                changes = [], [wfile], []
+            else:
+                changes = [], [], [wfile]
             opts = mdiff.diffopts(git=True, nodates=True)
             try:
-                for s in patch.diff(self.repo, n1, n2, changes=self.changes,
-                                    match=m, opts=opts):
+                for s in patch.diff(self.repo, n1, n2, changes=changes, opts=opts):
                     lines.extend(s.splitlines())
             except (error.RepoError, error.LookupError), e:
                 err = _('Repository Error:  %s, refresh suggested') % str(e)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.