{"thread":{"id":"10939","subject":"[PATCH] git-svn: add a show-externals command.","startedAt":"2007-11-19T22:56:15Z","lastAt":"2007-11-29T08:04:41Z","messageCount":2,"participants":["Vineet Kumar","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"60381","messageId":"1195512975-3647-1-git-send-email-vineet@doorstop.net","threadId":"10939","inReplyTo":null,"subject":"[PATCH] git-svn: add a show-externals command.","fromName":"Vineet Kumar","fromEmail":"vineet@doorstop.net","sentAt":"2007-11-19T22:56:15Z","receivedAt":"2007-11-19T22:56:15Z","isPatch":true,"sender":{"key":"vineet@doorstop.net","avatar":"https://gravatar.com/avatar/7eaf4d9b5b3c6cadffd6515fb81ede43381557eaad3e58c7140ff1fc5ccb41dd?d=mp&s=160"},"body":"show-externals can be used by scripts to provide svn:externals-like\nfunctionality.  For example, a script can list all of the externals and then\nuse check out the listed URLs at the appropriate paths, similar to what the svn\nclient does.  Said script (or perhaps git-svn itself, in the future) could\nsimply invoke svn export on the paths, or it could go one further, using\ngit-svn clone and even git-submodule together to better integrate externals\ncheckouts.\n\nThe implementation is shamelessly copied from show-ignores.  A more general\ncommand to list user-specified properties is probably a better idea.\n\nSigned-off-by: Vineet Kumar <vineet@doorstop.net>\n---\n git-svn.perl |   18 ++++++++++++++++++\n 1 files changed, 18 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 5b1deea..74966ed 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -141,6 +141,9 @@ my %cmd = (\n \t'show-ignore' => [ \\&cmd_show_ignore, \"Show svn:ignore listings\",\n \t\t\t{ 'revision|r=i' => \\$_revision\n \t\t\t} ],\n+\t'show-externals' => [ \\&cmd_show_externals, \"Show svn:externals listings\",\n+\t\t\t{ 'revision|r=i' => \\$_revision\n+\t\t\t} ],\n \t'multi-fetch' => [ \\&cmd_multi_fetch,\n \t                   \"Deprecated alias for $0 fetch --all\",\n \t\t\t   { 'revision|r=s' => \\$_revision, %fc_opts } ],\n@@ -560,6 +563,21 @@ sub cmd_show_ignore {\n \t});\n }\n \n+sub cmd_show_externals {\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\t$gs ||= Git::SVN->new;\n+\tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n+\t$gs->prop_walk($gs->{path}, $r, sub {\n+\t\tmy ($gs, $path, $props) = @_;\n+\t\tprint STDOUT \"\\n# $path\\n\";\n+\t\tmy $s = $props->{'svn:externals'} or return;\n+\t\t$s =~ s/[\\r\\n]+/\\n/g;\n+\t\tchomp $s;\n+\t\t$s =~ s#^#$path#gm;\n+\t\tprint STDOUT \"$s\\n\";\n+\t});\n+}\n+\n sub cmd_create_ignore {\n \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n \t$gs ||= Git::SVN->new;\n-- \n1.5.3.4\n"},{"id":"61377","messageId":"20071129080441.GE32277@soma","threadId":"10939","inReplyTo":"1195512975-3647-1-git-send-email-vineet@doorstop.net","subject":"Re: [PATCH] git-svn: add a show-externals command.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-11-29T08:04:41Z","receivedAt":"2007-11-29T08:04:41Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Vineet Kumar <vineet@doorstop.net> wrote:\n> show-externals can be used by scripts to provide svn:externals-like\n> functionality.  For example, a script can list all of the externals and then\n> use check out the listed URLs at the appropriate paths, similar to what the svn\n> client does.  Said script (or perhaps git-svn itself, in the future) could\n> simply invoke svn export on the paths, or it could go one further, using\n> git-svn clone and even git-submodule together to better integrate externals\n> checkouts.\n> \n> The implementation is shamelessly copied from show-ignores.  A more general\n> command to list user-specified properties is probably a better idea.\n> \n> Signed-off-by: Vineet Kumar <vineet@doorstop.net>\n\nThanks.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\nI'm close to having svn:externals supported in git-svn, too.  But\npreviously cloned repositories probably won't support them\nout-of-the-box, so this can still be useful.\n\n> ---\n>  git-svn.perl |   18 ++++++++++++++++++\n>  1 files changed, 18 insertions(+), 0 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 5b1deea..74966ed 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -141,6 +141,9 @@ my %cmd = (\n>  \t'show-ignore' => [ \\&cmd_show_ignore, \"Show svn:ignore listings\",\n>  \t\t\t{ 'revision|r=i' => \\$_revision\n>  \t\t\t} ],\n> +\t'show-externals' => [ \\&cmd_show_externals, \"Show svn:externals listings\",\n> +\t\t\t{ 'revision|r=i' => \\$_revision\n> +\t\t\t} ],\n>  \t'multi-fetch' => [ \\&cmd_multi_fetch,\n>  \t                   \"Deprecated alias for $0 fetch --all\",\n>  \t\t\t   { 'revision|r=s' => \\$_revision, %fc_opts } ],\n> @@ -560,6 +563,21 @@ sub cmd_show_ignore {\n>  \t});\n>  }\n>  \n> +sub cmd_show_externals {\n> +\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n> +\t$gs ||= Git::SVN->new;\n> +\tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n> +\t$gs->prop_walk($gs->{path}, $r, sub {\n> +\t\tmy ($gs, $path, $props) = @_;\n> +\t\tprint STDOUT \"\\n# $path\\n\";\n> +\t\tmy $s = $props->{'svn:externals'} or return;\n> +\t\t$s =~ s/[\\r\\n]+/\\n/g;\n> +\t\tchomp $s;\n> +\t\t$s =~ s#^#$path#gm;\n> +\t\tprint STDOUT \"$s\\n\";\n> +\t});\n> +}\n> +\n>  sub cmd_create_ignore {\n>  \tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n>  \t$gs ||= Git::SVN->new;\n> -- \n> 1.5.3.4\n> \n> -\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n-- \nEric Wong\n"}]}