Show More
@@ -2632,11 +2632,11 b' def remove(ui, repo, m, prefix, after, f' | |||||
2632 |
|
2632 | |||
2633 | return ret |
|
2633 | return ret | |
2634 |
|
2634 | |||
2635 | def cat(ui, repo, ctx, matcher, prefix, **opts): |
|
2635 | def cat(ui, repo, ctx, matcher, fntemplate, prefix, **opts): | |
2636 | err = 1 |
|
2636 | err = 1 | |
2637 |
|
2637 | |||
2638 | def write(path): |
|
2638 | def write(path): | |
2639 |
fp = makefileobj(repo, |
|
2639 | fp = makefileobj(repo, fntemplate, ctx.node(), | |
2640 | pathname=os.path.join(prefix, path)) |
|
2640 | pathname=os.path.join(prefix, path)) | |
2641 | data = ctx[path].data() |
|
2641 | data = ctx[path].data() | |
2642 | if opts.get('decode'): |
|
2642 | if opts.get('decode'): | |
@@ -2666,8 +2666,8 b' def cat(ui, repo, ctx, matcher, prefix, ' | |||||
2666 | try: |
|
2666 | try: | |
2667 | submatch = matchmod.subdirmatcher(subpath, matcher) |
|
2667 | submatch = matchmod.subdirmatcher(subpath, matcher) | |
2668 |
|
2668 | |||
2669 |
if not sub.cat(submatch, |
|
2669 | if not sub.cat(submatch, fntemplate, | |
2670 | **opts): |
|
2670 | os.path.join(prefix, sub._path), **opts): | |
2671 | err = 0 |
|
2671 | err = 0 | |
2672 | except error.RepoLookupError: |
|
2672 | except error.RepoLookupError: | |
2673 | ui.status(_("skipping missing subrepository: %s\n") |
|
2673 | ui.status(_("skipping missing subrepository: %s\n") |
@@ -1363,9 +1363,10 b' def cat(ui, repo, file1, *pats, **opts):' | |||||
1363 | """ |
|
1363 | """ | |
1364 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1364 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1365 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1365 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
|
1366 | fntemplate = opts.pop('output', '') | |||
1366 |
|
1367 | |||
1367 | ui.pager('cat') |
|
1368 | ui.pager('cat') | |
1368 | return cmdutil.cat(ui, repo, ctx, m, '', **opts) |
|
1369 | return cmdutil.cat(ui, repo, ctx, m, fntemplate, '', **opts) | |
1369 |
|
1370 | |||
1370 | @command('^clone', |
|
1371 | @command('^clone', | |
1371 | [('U', 'noupdate', None, _('the clone will include an empty working ' |
|
1372 | [('U', 'noupdate', None, _('the clone will include an empty working ' |
@@ -538,7 +538,7 b' class abstractsubrepo(object):' | |||||
538 | self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) |
|
538 | self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) | |
539 | return 1 |
|
539 | return 1 | |
540 |
|
540 | |||
541 | def cat(self, match, prefix, **opts): |
|
541 | def cat(self, match, fntemplate, prefix, **opts): | |
542 | return 1 |
|
542 | return 1 | |
543 |
|
543 | |||
544 | def status(self, rev2, **opts): |
|
544 | def status(self, rev2, **opts): | |
@@ -767,10 +767,11 b' class hgsubrepo(abstractsubrepo):' | |||||
767 | dry_run, similarity) |
|
767 | dry_run, similarity) | |
768 |
|
768 | |||
769 | @annotatesubrepoerror |
|
769 | @annotatesubrepoerror | |
770 | def cat(self, match, prefix, **opts): |
|
770 | def cat(self, match, fntemplate, prefix, **opts): | |
771 | rev = self._state[1] |
|
771 | rev = self._state[1] | |
772 | ctx = self._repo[rev] |
|
772 | ctx = self._repo[rev] | |
773 |
return cmdutil.cat(self.ui, self._repo, ctx, match, prefix, |
|
773 | return cmdutil.cat(self.ui, self._repo, ctx, match, fntemplate, prefix, | |
|
774 | **opts) | |||
774 |
|
775 | |||
775 | @annotatesubrepoerror |
|
776 | @annotatesubrepoerror | |
776 | def status(self, rev2, **opts): |
|
777 | def status(self, rev2, **opts): | |
@@ -1832,7 +1833,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1832 |
|
1833 | |||
1833 |
|
1834 | |||
1834 | @annotatesubrepoerror |
|
1835 | @annotatesubrepoerror | |
1835 | def cat(self, match, prefix, **opts): |
|
1836 | def cat(self, match, fntemplate, prefix, **opts): | |
1836 | rev = self._state[1] |
|
1837 | rev = self._state[1] | |
1837 | if match.anypats(): |
|
1838 | if match.anypats(): | |
1838 | return 1 #No support for include/exclude yet |
|
1839 | return 1 #No support for include/exclude yet | |
@@ -1842,7 +1843,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1842 |
|
1843 | |||
1843 | for f in match.files(): |
|
1844 | for f in match.files(): | |
1844 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) |
|
1845 | output = self._gitcommand(["show", "%s:%s" % (rev, f)]) | |
1845 |
fp = cmdutil.makefileobj(self._subparent, |
|
1846 | fp = cmdutil.makefileobj(self._subparent, fntemplate, | |
1846 | self._ctx.node(), |
|
1847 | self._ctx.node(), | |
1847 | pathname=self.wvfs.reljoin(prefix, f)) |
|
1848 | pathname=self.wvfs.reljoin(prefix, f)) | |
1848 | fp.write(output) |
|
1849 | fp.write(output) |
General Comments 0
You need to be logged in to leave comments.
Login now