diff mercurial/subrepo.py @ 24957:a48b65ab428d

subrepo: add include/exclude support for diffing git subrepos Previously, git subrepos were ignored if any type of path selection was done. This can be solved by using subrepo status and filtering matching files.
author Mathias De Maré <mathias.demare@gmail.com>
date Tue, 14 Apr 2015 20:09:56 +0200
parents 747748766421
children 39f519be5e65
line wrap: on
line diff
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -1779,17 +1779,15 @@
         if node2:
             cmd.append(node2)
 
-        if match.anypats():
-            return #No support for include/exclude yet
-
         output = ""
         if match.always():
             output += self._gitcommand(cmd) + '\n'
-        elif match.files():
-            for f in match.files():
-                output += self._gitcommand(cmd + [f]) + '\n'
-        elif match(gitprefix): #Subrepo is matched
-            output += self._gitcommand(cmd) + '\n'
+        else:
+            st = self.status(node2)[:3]
+            files = [f for sublist in st for f in sublist]
+            for f in files:
+                if match(f):
+                    output += self._gitcommand(cmd + ['--', f]) + '\n'
 
         if output.strip():
             ui.write(output)