Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 23991:07c1a7d1ef69
subrepo: add 'cat' support for git subrepos
V2: use 'self._ctx.node()' instead of 'rev' in makefileobj.
As Matt Harbison mentioned, using 'rev' does not make sense,
since we'd be passing a git revision to the top-level
Mercurial repository.
author | Mathias De Mar? <mathias.demare@gmail.com> |
---|---|
date | Sun, 01 Feb 2015 14:09:31 +0100 |
parents | 8f02682ff3b0 |
children | b5898bf7119a |
line wrap: on
line diff
--- a/mercurial/subrepo.py Mon Feb 02 12:50:48 2015 -0600 +++ b/mercurial/subrepo.py Sun Feb 01 14:09:31 2015 +0100 @@ -1577,6 +1577,25 @@ @annotatesubrepoerror + def cat(self, match, prefix, **opts): + rev = self._state[1] + if match.anypats(): + return 1 #No support for include/exclude yet + + if not match.files(): + return 1 + + for f in match.files(): + output = self._gitcommand(["show", "%s:%s" % (rev, f)]) + fp = cmdutil.makefileobj(self._subparent, opts.get('output'), + self._ctx.node(), + pathname=os.path.join(prefix, f)) + fp.write(output) + fp.close() + return 0 + + + @annotatesubrepoerror def status(self, rev2, **opts): rev1 = self._state[1] if self._gitmissing() or not rev1: