##// END OF EJS Templates
subrepo: add include/exclude support for diffing git subrepos...
Mathias De Maré -
r24778:a48b65ab default
parent child Browse files
Show More
@@ -1779,17 +1779,15 b' class gitsubrepo(abstractsubrepo):'
1779 1779 if node2:
1780 1780 cmd.append(node2)
1781 1781
1782 if match.anypats():
1783 return #No support for include/exclude yet
1784
1785 1782 output = ""
1786 1783 if match.always():
1787 1784 output += self._gitcommand(cmd) + '\n'
1788 elif match.files():
1789 for f in match.files():
1790 output += self._gitcommand(cmd + [f]) + '\n'
1791 elif match(gitprefix): #Subrepo is matched
1792 output += self._gitcommand(cmd) + '\n'
1785 else:
1786 st = self.status(node2)[:3]
1787 files = [f for sublist in st for f in sublist]
1788 for f in files:
1789 if match(f):
1790 output += self._gitcommand(cmd + ['--', f]) + '\n'
1793 1791
1794 1792 if output.strip():
1795 1793 ui.write(output)
@@ -785,9 +785,57 b' the output contains a regex, because git'
785 785 \s*foobar |\s*2 +- (re)
786 786 2 files changed, 2 insertions\(\+\), 1 deletions?\(-\) (re)
787 787
788 ensure adding include/exclude ignores the subrepo
788 adding an include should ignore the other elements
789 789 $ hg diff --subrepos -I s/foobar
790 diff --git a/s/foobar b/s/foobar
791 index 8a5a5e2..bd5812a 100644
792 --- a/s/foobar
793 +++ b/s/foobar
794 @@ -1,4 +1,4 @@
795 -woopwoop
796 +woop woop
797
798 foo
799 bar
800
801 adding an exclude should ignore this element
790 802 $ hg diff --subrepos -X s/foobar
803 diff --git a/s/barfoo b/s/barfoo
804 new file mode 100644
805 index 0000000..257cc56
806 --- /dev/null
807 +++ b/s/barfoo
808 @@ -0,0 +1 @@
809 +foo
810
811 moving a file should show a removal and an add
812 $ hg revert --all
813 reverting subrepo ../gitroot
814 $ cd s
815 $ git mv foobar woop
816 $ cd ..
817 $ hg diff --subrepos
818 diff --git a/s/foobar b/s/foobar
819 deleted file mode 100644
820 index 8a5a5e2..0000000
821 --- a/s/foobar
822 +++ /dev/null
823 @@ -1,4 +0,0 @@
824 -woopwoop
825 -
826 -foo
827 -bar
828 diff --git a/s/woop b/s/woop
829 new file mode 100644
830 index 0000000..8a5a5e2
831 --- /dev/null
832 +++ b/s/woop
833 @@ -0,0 +1,4 @@
834 +woopwoop
835 +
836 +foo
837 +bar
838 $ rm s/woop
791 839
792 840 revert the subrepository
793 841 $ hg revert --all
General Comments 0
You need to be logged in to leave comments. Login now