Show More
@@ -91,7 +91,7 b' Interaction with Mercurial Commands' | |||
|
91 | 91 | -S/--subrepos is specified. |
|
92 | 92 | |
|
93 | 93 | :cat: cat currently only handles exact file matches in subrepos. |
|
94 |
|
|
|
94 | Subversion subrepositories are currently ignored. | |
|
95 | 95 | |
|
96 | 96 | :commit: commit creates a consistent snapshot of the state of the |
|
97 | 97 | entire project and its subrepositories. If any subrepositories |
@@ -1577,6 +1577,25 b' class gitsubrepo(abstractsubrepo):' | |||
|
1577 | 1577 | |
|
1578 | 1578 | |
|
1579 | 1579 | @annotatesubrepoerror |
|
1580 | def cat(self, match, prefix, **opts): | |
|
1581 | rev = self._state[1] | |
|
1582 | if match.anypats(): | |
|
1583 | return 1 #No support for include/exclude yet | |
|
1584 | ||
|
1585 | if not match.files(): | |
|
1586 | return 1 | |
|
1587 | ||
|
1588 | for f in match.files(): | |
|
1589 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) | |
|
1590 | fp = cmdutil.makefileobj(self._subparent, opts.get('output'), | |
|
1591 | self._ctx.node(), | |
|
1592 | pathname=os.path.join(prefix, f)) | |
|
1593 | fp.write(output) | |
|
1594 | fp.close() | |
|
1595 | return 0 | |
|
1596 | ||
|
1597 | ||
|
1598 | @annotatesubrepoerror | |
|
1580 | 1599 | def status(self, rev2, **opts): |
|
1581 | 1600 | rev1 = self._state[1] |
|
1582 | 1601 | if self._gitmissing() or not rev1: |
@@ -802,4 +802,52 b' revert the subrepository' | |||
|
802 | 802 | $ hg status --subrepos |
|
803 | 803 | ? s/barfoo |
|
804 | 804 | |
|
805 | show file at specific revision | |
|
806 | $ cat > s/foobar << EOF | |
|
807 | > woop woop | |
|
808 | > fooo bar | |
|
809 | > EOF | |
|
810 | $ hg commit --subrepos -m "updated foobar" | |
|
811 | committing subrepository s | |
|
812 | $ cat > s/foobar << EOF | |
|
813 | > current foobar | |
|
814 | > (should not be visible using hg cat) | |
|
815 | > EOF | |
|
816 | ||
|
817 | $ hg cat -r . s/foobar | |
|
818 | woop woop | |
|
819 | fooo bar (no-eol) | |
|
820 | $ hg cat -r "parents(.)" s/foobar > catparents | |
|
821 | ||
|
822 | $ mkdir -p tmp/s | |
|
823 | ||
|
824 | $ hg cat -r "parents(.)" --output tmp/%% s/foobar | |
|
825 | $ diff tmp/% catparents | |
|
826 | ||
|
827 | $ hg cat -r "parents(.)" --output tmp/%s s/foobar | |
|
828 | $ diff tmp/foobar catparents | |
|
829 | ||
|
830 | $ hg cat -r "parents(.)" --output tmp/%d/otherfoobar s/foobar | |
|
831 | $ diff tmp/s/otherfoobar catparents | |
|
832 | ||
|
833 | $ hg cat -r "parents(.)" --output tmp/%p s/foobar | |
|
834 | $ diff tmp/s/foobar catparents | |
|
835 | ||
|
836 | $ hg cat -r "parents(.)" --output tmp/%H s/foobar | |
|
837 | $ diff tmp/255ee8cf690ec86e99b1e80147ea93ece117cd9d catparents | |
|
838 | ||
|
839 | $ hg cat -r "parents(.)" --output tmp/%R s/foobar | |
|
840 | $ diff tmp/10 catparents | |
|
841 | ||
|
842 | $ hg cat -r "parents(.)" --output tmp/%h s/foobar | |
|
843 | $ diff tmp/255ee8cf690e catparents | |
|
844 | ||
|
845 | $ rm tmp/10 | |
|
846 | $ hg cat -r "parents(.)" --output tmp/%r s/foobar | |
|
847 | $ diff tmp/10 catparents | |
|
848 | ||
|
849 | $ mkdir tmp/tc | |
|
850 | $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar | |
|
851 | $ diff tmp/tc/foobar catparents | |
|
852 | ||
|
805 | 853 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now