* [PATCH] git-svn: add a show-externals command.
@ 2007-11-19 22:56 Vineet Kumar
2007-11-29 8:04 ` Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Vineet Kumar @ 2007-11-19 22:56 UTC (permalink / raw)
To: git; +Cc: Vineet Kumar
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: Vineet Kumar <vineet@doorstop.net>
---
git-svn.perl | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 5b1deea..74966ed 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -141,6 +141,9 @@ my %cmd = (
'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings",
{ 'revision|r=i' => \$_revision
} ],
+ 'show-externals' => [ \&cmd_show_externals, "Show svn:externals listings",
+ { 'revision|r=i' => \$_revision
+ } ],
'multi-fetch' => [ \&cmd_multi_fetch,
"Deprecated alias for $0 fetch --all",
{ 'revision|r=s' => \$_revision, %fc_opts } ],
@@ -560,6 +563,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 {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] git-svn: add a show-externals command.
2007-11-19 22:56 [PATCH] git-svn: add a show-externals command Vineet Kumar
@ 2007-11-29 8:04 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2007-11-29 8:04 UTC (permalink / raw)
To: Vineet Kumar; +Cc: git
Vineet Kumar <vineet@doorstop.net> wrote:
> 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: Vineet Kumar <vineet@doorstop.net>
Thanks.
Acked-by: Eric Wong <normalperson@yhbt.net>
I'm close to having svn:externals supported in git-svn, too. But
previously cloned repositories probably won't support them
out-of-the-box, so this can still be useful.
> ---
> git-svn.perl | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 5b1deea..74966ed 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -141,6 +141,9 @@ my %cmd = (
> 'show-ignore' => [ \&cmd_show_ignore, "Show svn:ignore listings",
> { 'revision|r=i' => \$_revision
> } ],
> + 'show-externals' => [ \&cmd_show_externals, "Show svn:externals listings",
> + { 'revision|r=i' => \$_revision
> + } ],
> 'multi-fetch' => [ \&cmd_multi_fetch,
> "Deprecated alias for $0 fetch --all",
> { 'revision|r=s' => \$_revision, %fc_opts } ],
> @@ -560,6 +563,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 {
> my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
> $gs ||= Git::SVN->new;
> --
> 1.5.3.4
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Eric Wong
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-29 8:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19 22:56 [PATCH] git-svn: add a show-externals command Vineet Kumar
2007-11-29 8:04 ` Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).