Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
23990:a8dc5a3f4f4c | 23991:07c1a7d1ef69 |
---|---|
1575 self.ui.progress(_('archiving (%s)') % relpath, None) | 1575 self.ui.progress(_('archiving (%s)') % relpath, None) |
1576 return total | 1576 return total |
1577 | 1577 |
1578 | 1578 |
1579 @annotatesubrepoerror | 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 def status(self, rev2, **opts): | 1599 def status(self, rev2, **opts): |
1581 rev1 = self._state[1] | 1600 rev1 = self._state[1] |
1582 if self._gitmissing() or not rev1: | 1601 if self._gitmissing() or not rev1: |
1583 # if the repo is missing, return no results | 1602 # if the repo is missing, return no results |
1584 return [], [], [], [], [], [], [] | 1603 return [], [], [], [], [], [], [] |