提交 2d879792 编写于 作者: V Vineet Kumar 提交者: Eric Wong

git-svn: add a show-externals command.

show-externals can be used by scripts to provide svn:externals-like
functionality.  For example, a script can list all of the externals and then
use check out the listed URLs at the appropriate paths, similar to what the svn
client does.  Said script (or perhaps git-svn itself, in the future) could
simply invoke svn export on the paths, or it could go one further, using
git-svn clone and even git-submodule together to better integrate externals
checkouts.

The implementation is shamelessly copied from show-ignores.  A more general
command to list user-specified properties is probably a better idea.
Signed-off-by: NVineet Kumar <vineet@doorstop.net>
Acked-by: NEric Wong <normalperson@yhbt.net>
上级 8d7c4fad
...@@ -143,6 +143,9 @@ BEGIN ...@@ -143,6 +143,9 @@ BEGIN
'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings", 'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings",
{ 'revision|r=i' => \$_revision { 'revision|r=i' => \$_revision
} ], } ],
'show-externals' => [ \&cmd_show_externals, "Show svn:externals listings",
{ 'revision|r=i' => \$_revision
} ],
'multi-fetch' => [ \&cmd_multi_fetch, 'multi-fetch' => [ \&cmd_multi_fetch,
"Deprecated alias for $0 fetch --all", "Deprecated alias for $0 fetch --all",
{ 'revision|r=s' => \$_revision, %fc_opts } ], { 'revision|r=s' => \$_revision, %fc_opts } ],
...@@ -567,6 +570,21 @@ sub cmd_show_ignore { ...@@ -567,6 +570,21 @@ sub cmd_show_ignore {
}); });
} }
sub cmd_show_externals {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new;
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
$gs->prop_walk($gs->{path}, $r, sub {
my ($gs, $path, $props) = @_;
print STDOUT "\n# $path\n";
my $s = $props->{'svn:externals'} or return;
$s =~ s/[\r\n]+/\n/g;
chomp $s;
$s =~ s#^#$path#gm;
print STDOUT "$s\n";
});
}
sub cmd_create_ignore { sub cmd_create_ignore {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD'); my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new; $gs ||= Git::SVN->new;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册