Show More
@@ -98,8 +98,8 b' Interaction with Mercurial Commands' | |||
|
98 | 98 | |
|
99 | 99 | :diff: diff does not recurse in subrepos unless -S/--subrepos is |
|
100 | 100 | specified. Changes are displayed as usual, on the subrepositories |
|
101 | elements. Git and Subversion subrepositories are currently | |
|
102 | silently ignored. | |
|
101 | elements. Git subrepositories do not support --include/--exclude. | |
|
102 | Subversion subrepositories are currently silently ignored. | |
|
103 | 103 | |
|
104 | 104 | :forget: forget currently only handles exact file matches in subrepos. |
|
105 | 105 | Git and Subversion subrepositories are currently silently ignored. |
@@ -1593,6 +1593,48 b' class gitsubrepo(abstractsubrepo):' | |||
|
1593 | 1593 | return scmutil.status(modified, added, removed, deleted, |
|
1594 | 1594 | unknown, ignored, clean) |
|
1595 | 1595 | |
|
1596 | @annotatesubrepoerror | |
|
1597 | def diff(self, ui, diffopts, node2, match, prefix, **opts): | |
|
1598 | node1 = self._state[1] | |
|
1599 | cmd = ['diff'] | |
|
1600 | if opts['stat']: | |
|
1601 | cmd.append('--stat') | |
|
1602 | else: | |
|
1603 | # for Git, this also implies '-p' | |
|
1604 | cmd.append('-U%d' % diffopts.context) | |
|
1605 | ||
|
1606 | gitprefix = os.path.join(prefix, self._path) | |
|
1607 | ||
|
1608 | if diffopts.noprefix: | |
|
1609 | cmd.extend(['--src-prefix=%s/' % gitprefix, | |
|
1610 | '--dst-prefix=%s/' % gitprefix]) | |
|
1611 | else: | |
|
1612 | cmd.extend(['--src-prefix=a/%s/' % gitprefix, | |
|
1613 | '--dst-prefix=b/%s/' % gitprefix]) | |
|
1614 | ||
|
1615 | if diffopts.ignorews: | |
|
1616 | cmd.append('--ignore-all-space') | |
|
1617 | if diffopts.ignorewsamount: | |
|
1618 | cmd.append('--ignore-space-change') | |
|
1619 | if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \ | |
|
1620 | and diffopts.ignoreblanklines: | |
|
1621 | cmd.append('--ignore-blank-lines') | |
|
1622 | ||
|
1623 | cmd.append(node1) | |
|
1624 | if node2: | |
|
1625 | cmd.append(node2) | |
|
1626 | ||
|
1627 | if match.anypats(): | |
|
1628 | return #No support for include/exclude yet | |
|
1629 | ||
|
1630 | if match.always(): | |
|
1631 | ui.write(self._gitcommand(cmd)) | |
|
1632 | elif match.files(): | |
|
1633 | for f in match.files(): | |
|
1634 | ui.write(self._gitcommand(cmd + [f])) | |
|
1635 | elif match(gitprefix): #Subrepo is matched | |
|
1636 | ui.write(self._gitcommand(cmd)) | |
|
1637 | ||
|
1596 | 1638 | def shortid(self, revid): |
|
1597 | 1639 | return revid[:7] |
|
1598 | 1640 |
@@ -103,6 +103,15 b' clone root, make local change' | |||
|
103 | 103 | $ echo ggg >> s/g |
|
104 | 104 | $ hg status --subrepos |
|
105 | 105 | M s/g |
|
106 | $ hg diff --subrepos | |
|
107 | diff --git a/s/g b/s/g | |
|
108 | index 089258f..85341ee 100644 | |
|
109 | --- a/s/g | |
|
110 | +++ b/s/g | |
|
111 | @@ -1,2 +1,3 @@ | |
|
112 | g | |
|
113 | gg | |
|
114 | +ggg (no-eol) | |
|
106 | 115 | $ hg commit --subrepos -m ggg |
|
107 | 116 | committing subrepository s |
|
108 | 117 | $ hg debugsub |
@@ -664,4 +673,112 b' Test that sanitizing is omitted in meta ' | |||
|
664 | 673 | checking out detached HEAD in subrepo s |
|
665 | 674 | check out a git branch if you intend to make changes |
|
666 | 675 | |
|
676 | check differences made by most recent change | |
|
677 | $ cd s | |
|
678 | $ cat > foobar << EOF | |
|
679 | > woopwoop | |
|
680 | > | |
|
681 | > foo | |
|
682 | > bar | |
|
683 | > EOF | |
|
684 | $ git add foobar | |
|
667 | 685 | $ cd .. |
|
686 | ||
|
687 | $ hg diff --subrepos | |
|
688 | diff --git a/s/foobar b/s/foobar | |
|
689 | new file mode 100644 | |
|
690 | index 0000000..8a5a5e2 | |
|
691 | --- /dev/null | |
|
692 | +++ b/s/foobar | |
|
693 | @@ -0,0 +1,4 @@ | |
|
694 | +woopwoop | |
|
695 | + | |
|
696 | +foo | |
|
697 | +bar (no-eol) | |
|
698 | ||
|
699 | $ hg commit --subrepos -m "Added foobar" | |
|
700 | committing subrepository s | |
|
701 | created new head | |
|
702 | ||
|
703 | $ hg diff -c . --subrepos --nodates | |
|
704 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate | |
|
705 | --- a/.hgsubstate | |
|
706 | +++ b/.hgsubstate | |
|
707 | @@ -1,1 +1,1 @@ | |
|
708 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s | |
|
709 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s | |
|
710 | diff --git a/s/foobar b/s/foobar | |
|
711 | new file mode 100644 | |
|
712 | index 0000000..8a5a5e2 | |
|
713 | --- /dev/null | |
|
714 | +++ b/s/foobar | |
|
715 | @@ -0,0 +1,4 @@ | |
|
716 | +woopwoop | |
|
717 | + | |
|
718 | +foo | |
|
719 | +bar (no-eol) | |
|
720 | ||
|
721 | check output when only diffing the subrepository | |
|
722 | $ hg diff -c . --subrepos s | |
|
723 | diff --git a/s/foobar b/s/foobar | |
|
724 | new file mode 100644 | |
|
725 | index 0000000..8a5a5e2 | |
|
726 | --- /dev/null | |
|
727 | +++ b/s/foobar | |
|
728 | @@ -0,0 +1,4 @@ | |
|
729 | +woopwoop | |
|
730 | + | |
|
731 | +foo | |
|
732 | +bar (no-eol) | |
|
733 | ||
|
734 | check output when diffing something else | |
|
735 | $ hg diff -c . --subrepos .hgsubstate --nodates | |
|
736 | diff -r af6d2edbb0d3 -r 255ee8cf690e .hgsubstate | |
|
737 | --- a/.hgsubstate | |
|
738 | +++ b/.hgsubstate | |
|
739 | @@ -1,1 +1,1 @@ | |
|
740 | -32a343883b74769118bb1d3b4b1fbf9156f4dddc s | |
|
741 | +fd4dbf828a5b2fcd36b2bcf21ea773820970d129 s | |
|
742 | ||
|
743 | add new changes, including whitespace | |
|
744 | $ cd s | |
|
745 | $ cat > foobar << EOF | |
|
746 | > woop woop | |
|
747 | > | |
|
748 | > foo | |
|
749 | > bar | |
|
750 | > EOF | |
|
751 | $ echo foo > barfoo | |
|
752 | $ git add barfoo | |
|
753 | $ cd .. | |
|
754 | ||
|
755 | $ hg diff --subrepos --ignore-all-space | |
|
756 | diff --git a/s/barfoo b/s/barfoo | |
|
757 | new file mode 100644 | |
|
758 | index 0000000..257cc56 | |
|
759 | --- /dev/null | |
|
760 | +++ b/s/barfoo | |
|
761 | @@ -0,0 +1 @@ | |
|
762 | +foo (no-eol) | |
|
763 | $ hg diff --subrepos s/foobar | |
|
764 | diff --git a/s/foobar b/s/foobar | |
|
765 | index 8a5a5e2..bd5812a 100644 | |
|
766 | --- a/s/foobar | |
|
767 | +++ b/s/foobar | |
|
768 | @@ -1,4 +1,4 @@ | |
|
769 | -woopwoop | |
|
770 | +woop woop | |
|
771 | ||
|
772 | foo | |
|
773 | bar (no-eol) | |
|
774 | ||
|
775 | $ hg diff --subrepos --stat | |
|
776 | barfoo | 1 + | |
|
777 | foobar | 2 +- | |
|
778 | 2 files changed, 2 insertions(+), 1 deletion(-) (no-eol) | |
|
779 | ||
|
780 | ensure adding include/exclude ignores the subrepo | |
|
781 | $ hg diff --subrepos -I s/foobar | |
|
782 | $ hg diff --subrepos -X s/foobar | |
|
783 | ||
|
784 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now