{"thread":{"id":"18754","subject":"[PATCH] git-svn: add fetch --parent option","startedAt":"2009-04-06T20:37:59Z","lastAt":"2009-04-08T02:14:08Z","messageCount":2,"participants":["Jason Merrill","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110626","messageId":"49DA6827.9020204@redhat.com","threadId":"18754","inReplyTo":null,"subject":"[PATCH] git-svn: add fetch --parent option","fromName":"Jason Merrill","fromEmail":"jason@redhat.com","sentAt":"2009-04-06T20:37:59Z","receivedAt":"2009-04-06T20:37:59Z","isPatch":true,"sender":{"key":"jason@redhat.com","avatar":"https://avatars.githubusercontent.com/u/266146?v=4"},"body":"\n\n\nSigned-off-by: Jason Merrill <jason@redhat.com>\n---\nrebase fetches only the SVN parent of the current HEAD; it should\nbe possible to do that with fetch as well, for instance to support\nrebasing with stg rebase rather than git rebase.\n\n Documentation/git-svn.txt |    3 +++\n git-svn.perl              |   18 ++++++++++++++----\n 2 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex b7b1af8..85b2c8d 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -97,6 +97,9 @@ COMMANDS\n \tmakes 'git-log' (even without --date=local) show the same times\n \tthat `svn log` would in the local timezone.\n \n+--parent;;\n+\tFetch only from the SVN parent of the current HEAD.\n+\n This doesn't interfere with interoperating with the Subversion\n repository you cloned from, but if you wish for your local Git\n repository to be able to interoperate with someone else's local Git\ndiff --git a/git-svn.perl b/git-svn.perl\nindex d919798..cb718b8 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -63,7 +63,7 @@ $sha1_short = qr/[a-f\\d]{4,40}/;\n my ($_stdin, $_help, $_edit,\n \t$_message, $_file,\n \t$_template, $_shared,\n-\t$_version, $_fetch_all, $_no_rebase,\n+\t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n \t$_merge, $_strategy, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_url, $_verbose,\n \t$_git_format, $_commit_url, $_tag);\n@@ -112,6 +112,7 @@ my %cmd = (\n \tfetch => [ \\&cmd_fetch, \"Download new revisions from SVN\",\n \t\t\t{ 'revision|r=s' => \\$_revision,\n \t\t\t  'fetch-all|all' => \\$_fetch_all,\n+\t\t\t  'parent|p' => \\$_fetch_parent,\n \t\t\t   %fc_opts } ],\n \tclone => [ \\&cmd_clone, \"Initialize and fetch revisions\",\n \t\t\t{ 'revision|r=s' => \\$_revision,\n@@ -381,12 +382,21 @@ sub cmd_fetch {\n \t}\n \tmy ($remote) = @_;\n \tif (@_ > 1) {\n-\t\tdie \"Usage: $0 fetch [--all] [svn-remote]\\n\";\n+\t\tdie \"Usage: $0 fetch [--all] [--parent] [svn-remote]\\n\";\n \t}\n-\t$remote ||= $Git::SVN::default_repo_id;\n-\tif ($_fetch_all) {\n+\tif ($_fetch_parent) {\n+\t\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\t\tunless ($gs) {\n+\t\t\tdie \"Unable to determine upstream SVN information from \",\n+\t\t\t    \"working tree history\\n\";\n+\t\t}\n+\t        # just fetch, don't checkout.\n+\t\t$_no_checkout = 'true';\n+\t\t$_fetch_all ? $gs->fetch_all : $gs->fetch;\n+\t} elsif ($_fetch_all) {\n \t\tcmd_multi_fetch();\n \t} else {\n+\t\t$remote ||= $Git::SVN::default_repo_id;\n \t\tGit::SVN::fetch_all($remote, Git::SVN::read_all_remotes());\n \t}\n }\n-- \n1.6.2.2\n\n"},{"id":"110767","messageId":"20090408021408.GC20161@dcvr.yhbt.net","threadId":"18754","inReplyTo":"49DA6827.9020204@redhat.com","subject":"Re: [PATCH] git-svn: add fetch --parent option","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-04-08T02:14:08Z","receivedAt":"2009-04-08T02:14:08Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Jason Merrill <jason@redhat.com> wrote:\n> Signed-off-by: Jason Merrill <jason@redhat.com>\n> ---\n> rebase fetches only the SVN parent of the current HEAD; it should\n> be possible to do that with fetch as well, for instance to support\n> rebasing with stg rebase rather than git rebase.\n\nHi Jason, the above should be in the commit message.\n\nOtherwise, Acked-by: Eric Wong <normalperson@yhbt.net>\n\nThanks\n\n>  Documentation/git-svn.txt |    3 +++\n>  git-svn.perl              |   18 ++++++++++++++----\n>  2 files changed, 17 insertions(+), 4 deletions(-)\n> \n> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\n> index b7b1af8..85b2c8d 100644\n> --- a/Documentation/git-svn.txt\n> +++ b/Documentation/git-svn.txt\n> @@ -97,6 +97,9 @@ COMMANDS\n>  \tmakes 'git-log' (even without --date=local) show the same times\n>  \tthat `svn log` would in the local timezone.\n>  \n> +--parent;;\n> +\tFetch only from the SVN parent of the current HEAD.\n> +\n>  This doesn't interfere with interoperating with the Subversion\n>  repository you cloned from, but if you wish for your local Git\n>  repository to be able to interoperate with someone else's local Git\n> diff --git a/git-svn.perl b/git-svn.perl\n> index d919798..cb718b8 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -63,7 +63,7 @@ $sha1_short = qr/[a-f\\d]{4,40}/;\n>  my ($_stdin, $_help, $_edit,\n>  \t$_message, $_file,\n>  \t$_template, $_shared,\n> -\t$_version, $_fetch_all, $_no_rebase,\n> +\t$_version, $_fetch_all, $_no_rebase, $_fetch_parent,\n>  \t$_merge, $_strategy, $_dry_run, $_local,\n>  \t$_prefix, $_no_checkout, $_url, $_verbose,\n>  \t$_git_format, $_commit_url, $_tag);\n> @@ -112,6 +112,7 @@ my %cmd = (\n>  \tfetch => [ \\&cmd_fetch, \"Download new revisions from SVN\",\n>  \t\t\t{ 'revision|r=s' => \\$_revision,\n>  \t\t\t  'fetch-all|all' => \\$_fetch_all,\n> +\t\t\t  'parent|p' => \\$_fetch_parent,\n>  \t\t\t   %fc_opts } ],\n>  \tclone => [ \\&cmd_clone, \"Initialize and fetch revisions\",\n>  \t\t\t{ 'revision|r=s' => \\$_revision,\n> @@ -381,12 +382,21 @@ sub cmd_fetch {\n>  \t}\n>  \tmy ($remote) = @_;\n>  \tif (@_ > 1) {\n> -\t\tdie \"Usage: $0 fetch [--all] [svn-remote]\\n\";\n> +\t\tdie \"Usage: $0 fetch [--all] [--parent] [svn-remote]\\n\";\n>  \t}\n> -\t$remote ||= $Git::SVN::default_repo_id;\n> -\tif ($_fetch_all) {\n> +\tif ($_fetch_parent) {\n> +\t\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n> +\t\tunless ($gs) {\n> +\t\t\tdie \"Unable to determine upstream SVN information from \",\n> +\t\t\t    \"working tree history\\n\";\n> +\t\t}\n> +\t        # just fetch, don't checkout.\n> +\t\t$_no_checkout = 'true';\n> +\t\t$_fetch_all ? $gs->fetch_all : $gs->fetch;\n> +\t} elsif ($_fetch_all) {\n>  \t\tcmd_multi_fetch();\n>  \t} else {\n> +\t\t$remote ||= $Git::SVN::default_repo_id;\n>  \t\tGit::SVN::fetch_all($remote, Git::SVN::read_all_remotes());\n>  \t}\n>  }\n> -- \n"}]}