Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 21041:a2cc3c08c3ac
cat: support cat with explicit paths in subrepos
The cat command with an explicit path into a subrepo is now handled by invoking
cat on the file, from that subrepo. The previous behavior was to complain that
the file didn't exist in the revision (of the top most repo). Now when the file
is actually missing, the revision of the subrepo is named instead (though it is
probably desirable to continue naming the top level repo).
The documented output formatters %d and %p reflect the path from the top level
repo, since the purpose of this is to give the illusion of a unified repository.
Support for the undocumented (for cat) formatters %H, %R, %h, %m and %r was
added long ago (I tested back as far as 0.5), but unfortunately these will
reflect the subrepo node instead of the parent context.
The previous implementation was a bit loose with the return value, i.e. it would
return 0 if _any_ file requested was cat'd successfully. This maintains that
behavior.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 14 Mar 2014 21:32:05 -0400 |
parents | bdf5ed5246d2 |
children | 7f875ed19475 |
comparison
equal
deleted
inserted
replaced
21040:bdf5ed5246d2 | 21041:a2cc3c08c3ac |
---|---|
1172 Returns 0 on success. | 1172 Returns 0 on success. |
1173 """ | 1173 """ |
1174 ctx = scmutil.revsingle(repo, opts.get('rev')) | 1174 ctx = scmutil.revsingle(repo, opts.get('rev')) |
1175 m = scmutil.match(ctx, (file1,) + pats, opts) | 1175 m = scmutil.match(ctx, (file1,) + pats, opts) |
1176 | 1176 |
1177 return cmdutil.cat(ui, repo, ctx, m, **opts) | 1177 return cmdutil.cat(ui, repo, ctx, m, '', **opts) |
1178 | 1178 |
1179 @command('^clone', | 1179 @command('^clone', |
1180 [('U', 'noupdate', None, | 1180 [('U', 'noupdate', None, |
1181 _('the clone will include an empty working copy (only a repository)')), | 1181 _('the clone will include an empty working copy (only a repository)')), |
1182 ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), | 1182 ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), |