{"thread":{"id":"8434","subject":"[PATCH] git-svn: allow to specify svn branch for commands","startedAt":"2007-06-05T03:42:37Z","lastAt":"2007-06-05T09:56:24Z","messageCount":6,"participants":["Sam Vilain","Eric Wong","Stephen Touset"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"44026","messageId":"1181014957993-git-send-email-sam.vilain@catalyst.net.nz","threadId":"8434","inReplyTo":null,"subject":"[PATCH] git-svn: allow to specify svn branch for commands","fromName":"Sam Vilain","fromEmail":"sam.vilain@catalyst.net.nz","sentAt":"2007-06-05T03:42:37Z","receivedAt":"2007-06-05T03:42:37Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"\"git-svn dcommit\" ends up making an arbitrary decision when pushing\nback merges.  Allow the user to specify which one is used, albeit in a\nrather hack-ish way.\n---\n Documentation/git-svn.txt |   11 +++++++++++\n git-svn.perl              |   16 +++++++++-------\n 2 files changed, 20 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex c0d7d95..3e64522 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -69,6 +69,17 @@ COMMANDS\n \targument if that is what you want.  This is useful if\n \tyou wish to track multiple projects that share a common\n \trepository.\n+-B<svn_branch>;;\n+--branch=<svn_branch>;;\n+\tNormally, git-svn is capable of figuring out which branch you\n+\tare working on.  However, if you are doing merges between svn\n+\tbranches using git then the decision about which branch to\n+\tdcommit to will end up being made based on which of the\n+\tbranches you are merging has the newest upstream commit.  This\n+\toption enables a global filter that tells git-svn what to look\n+\tfor in the git-svn-id: line - specify a repository UUID or a\n+\tbranch name here.  So, it may be used with \"git-svn log\",\n+\t\"git-svn dcommit\", etc.\n \n 'fetch'::\n \tFetch unfetched revisions from the Subversion remote we are\ndiff --git a/git-svn.perl b/git-svn.perl\nindex e350061..b667f80 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -54,7 +54,7 @@ $sha1 = qr/[a-f\\d]{40}/;\n $sha1_short = qr/[a-f\\d]{4,40}/;\n my ($_stdin, $_help, $_edit,\n \t$_message, $_file,\n-\t$_template, $_shared,\n+\t$_template, $_shared, $_branch,\n \t$_version, $_fetch_all, $_no_rebase,\n \t$_merge, $_strategy, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_verbose);\n@@ -69,6 +69,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \\$Git::SVN::_follow_parent,\n \t\t'useSvmProps' => \\$Git::SVN::_use_svm_props,\n \t\t'useSvnsyncProps' => \\$Git::SVN::_use_svnsync_props,\n \t\t'log-window-size=i' => \\$Git::SVN::Ra::_log_window_size,\n+\t\t'branch|B=s' => \\$_branch,\n \t\t'no-checkout' => \\$_no_checkout,\n \t\t'quiet|q' => \\$_q,\n \t\t'repack-flags|repack-args|repack-opts=s' =>\n@@ -367,7 +368,7 @@ sub cmd_dcommit {\n \tmy $head = shift;\n \t$head ||= 'HEAD';\n \tmy @refs;\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs);\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs, $_branch);\n \tunless ($gs) {\n \t\tdie \"Unable to determine upstream SVN information from \",\n \t\t    \"$head history\\n\";\n@@ -441,7 +442,7 @@ sub cmd_find_rev {\n \t\tmy $head = shift;\n \t\t$head ||= 'HEAD';\n \t\tmy @refs;\n-\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs);\n+\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs, $_branch);\n \t\tunless ($gs) {\n \t\t\tdie \"Unable to determine upstream SVN information from \",\n \t\t\t    \"$head history\\n\";\n@@ -457,7 +458,7 @@ sub cmd_find_rev {\n \n sub cmd_rebase {\n \tcommand_noisy(qw/update-index --refresh/);\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n \tunless ($gs) {\n \t\tdie \"Unable to determine upstream SVN information from \",\n \t\t    \"working tree history\\n\";\n@@ -474,7 +475,7 @@ sub cmd_rebase {\n }\n \n sub cmd_show_ignore {\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n \t$gs->traverse_ignore(\\*STDOUT, $gs->{path}, $r);\n@@ -801,11 +802,12 @@ sub cmt_metadata {\n }\n \n sub working_head_info {\n-\tmy ($head, $refs) = @_;\n+\tmy ($head, $refs, $grep) = @_;\n \tmy ($fh, $ctx) = command_output_pipe('rev-list', $head);\n \twhile (my $hash = <$fh>) {\n \t\tchomp($hash);\n \t\tmy ($url, $rev, $uuid) = cmt_metadata($hash);\n+\t\tnext unless (!$grep or $url =~ m{$grep} or $uuid =~ m{$grep});\n \t\tif (defined $url && defined $rev) {\n \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n \t\t\t\tmy $c = $gs->rev_db_get($rev);\n@@ -3394,7 +3396,7 @@ sub git_svn_log_cmd {\n \t\tlast;\n \t}\n \n-\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head);\n+\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head, undef, $_branch);\n \t$gs ||= Git::SVN->_new;\n \tmy @cmd = (qw/log --abbrev-commit --pretty=raw --default/,\n \t           $gs->refname);\n-- \n1.5.2.0.45.gfea6d-dirty\n"},{"id":"44029","messageId":"20070605041446.GA4266@untitled","threadId":"8434","inReplyTo":"1181014957993-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-svn: allow to specify svn branch for commands","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-05T04:14:47Z","receivedAt":"2007-06-05T04:14:47Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Sam Vilain <sam.vilain@catalyst.net.nz> wrote:\n> \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n> back merges.  Allow the user to specify which one is used, albeit in a\n> rather hack-ish way.\n\nFrightening...  Perhaps we should echo the final URL out\nto the user and prompt them for confirmation.\n\n> ---\n>  Documentation/git-svn.txt |   11 +++++++++++\n>  git-svn.perl              |   16 +++++++++-------\n>  2 files changed, 20 insertions(+), 7 deletions(-)\n> \n> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\n> index c0d7d95..3e64522 100644\n> --- a/Documentation/git-svn.txt\n> +++ b/Documentation/git-svn.txt\n> @@ -69,6 +69,17 @@ COMMANDS\n>  \targument if that is what you want.  This is useful if\n>  \tyou wish to track multiple projects that share a common\n>  \trepository.\n> +-B<svn_branch>;;\n> +--branch=<svn_branch>;;\n> +\tNormally, git-svn is capable of figuring out which branch you\n> +\tare working on.  However, if you are doing merges between svn\n> +\tbranches using git then the decision about which branch to\n> +\tdcommit to will end up being made based on which of the\n> +\tbranches you are merging has the newest upstream commit.  This\n> +\toption enables a global filter that tells git-svn what to look\n> +\tfor in the git-svn-id: line - specify a repository UUID or a\n> +\tbranch name here.  So, it may be used with \"git-svn log\",\n> +\t\"git-svn dcommit\", etc.\n\nThis should clarify that a Perl regular expression is used.\n'.' can match '-' or '_' which is also pretty common in version\nnumbers.  Perhaps give an -F(ixed-string) option like grep does?\n\n>  sub working_head_info {\n> -\tmy ($head, $refs) = @_;\n> +\tmy ($head, $refs, $grep) = @_;\n>  \tmy ($fh, $ctx) = command_output_pipe('rev-list', $head);\n>  \twhile (my $hash = <$fh>) {\n>  \t\tchomp($hash);\n>  \t\tmy ($url, $rev, $uuid) = cmt_metadata($hash);\n> +\t\tnext unless (!$grep or $url =~ m{$grep} or $uuid =~ m{$grep});\n> @@ -3394,7 +3396,7 @@ sub git_svn_log_cmd {\n\n-- \nEric Wong\n"},{"id":"44030","messageId":"1181017002.27463.3.camel@megatron","threadId":"8434","inReplyTo":"1181014957993-git-send-email-sam.vilain@catalyst.net.nz","subject":"Re: [PATCH] git-svn: allow to specify svn branch for commands","fromName":"Stephen Touset","fromEmail":"stephen@touset.org","sentAt":"2007-06-05T04:16:42Z","receivedAt":"2007-06-05T04:16:42Z","isPatch":true,"sender":{"key":"stephen@touset.org","avatar":null},"body":"On Tue, 2007-06-05 at 15:42 +1200, Sam Vilain wrote:\n> \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n> back merges.  Allow the user to specify which one is used, albeit in a\n> rather hack-ish way.\n\nI've been thinking about this. I'm rather new to git internals, but if\nI've created a local copy of a remote branch (git-checkout -b\nlocal-branch --track remote-branch), can't git-svn use the tracking\nmetadata to determine which part of the tree to dcommit to?\n\n-- \nStephen Touset <stephen@touset.org>\n"},{"id":"44031","messageId":"4664E546.5060304@vilain.net","threadId":"8434","inReplyTo":"20070605041446.GA4266@untitled","subject":"Re: [PATCH] git-svn: allow to specify svn branch for commands","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2007-06-05T04:23:34Z","receivedAt":"2007-06-05T04:23:34Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Eric Wong wrote:\n> Sam Vilain <sam.vilain@catalyst.net.nz> wrote:\n>> \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n>> back merges.  Allow the user to specify which one is used, albeit in a\n>> rather hack-ish way.\n> \n> Frightening...  Perhaps we should echo the final URL out\n> to the user and prompt them for confirmation.\n\nActually in between sending this to the list, I figured that it should\nbe possible to detect when this is happening, at the expense of an extra\n\"git-log\" command.  Basically, take the first revision you found a\ncommitlog entry in, and then do a log from the indicated head excluding\nthat commit.  If you find more valid tips then the user is merging in\ngitspace.\n\nOf course ideally you want to make sure that merge commits posted back\nare shipped with all of the necessary tokens for the various SVN-land\ntools out there.  eg, svk:merge, svnmerge, and whatever kooky system the\nSVN dev team come up with.  But that's a separate issue.\n\nThe original patch had a fairly dire bug, so here's a version that at\nleast doesn't break the test suite.\n\nSubject: [PATCH] git-svn: allow to specify svn branch for commands\n\n\"git-svn dcommit\" ends up making an arbitrary decision when pushing\nback merges.  Allow the user to specify which one is used, albeit in a\nrather hack-ish way.\n---\n\n Documentation/git-svn.txt |   11 +++++++++++\n git-svn.perl              |   17 ++++++++++-------\n 2 files changed, 21 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex c0d7d95..3e64522 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -69,6 +69,17 @@ COMMANDS\n \targument if that is what you want.  This is useful if\n \tyou wish to track multiple projects that share a common\n \trepository.\n+-B<svn_branch>;;\n+--branch=<svn_branch>;;\n+\tNormally, git-svn is capable of figuring out which branch you\n+\tare working on.  However, if you are doing merges between svn\n+\tbranches using git then the decision about which branch to\n+\tdcommit to will end up being made based on which of the\n+\tbranches you are merging has the newest upstream commit.  This\n+\toption enables a global filter that tells git-svn what to look\n+\tfor in the git-svn-id: line - specify a repository UUID or a\n+\tbranch name here.  So, it may be used with \"git-svn log\",\n+\t\"git-svn dcommit\", etc.\n \n 'fetch'::\n \tFetch unfetched revisions from the Subversion remote we are\ndiff --git a/git-svn.perl b/git-svn.perl\nindex e350061..906aa4b 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -54,7 +54,7 @@ $sha1 = qr/[a-f\\d]{40}/;\n $sha1_short = qr/[a-f\\d]{4,40}/;\n my ($_stdin, $_help, $_edit,\n \t$_message, $_file,\n-\t$_template, $_shared,\n+\t$_template, $_shared, $_branch,\n \t$_version, $_fetch_all, $_no_rebase,\n \t$_merge, $_strategy, $_dry_run, $_local,\n \t$_prefix, $_no_checkout, $_verbose);\n@@ -69,6 +69,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \\$Git::SVN::_follow_parent,\n \t\t'useSvmProps' => \\$Git::SVN::_use_svm_props,\n \t\t'useSvnsyncProps' => \\$Git::SVN::_use_svnsync_props,\n \t\t'log-window-size=i' => \\$Git::SVN::Ra::_log_window_size,\n+\t\t'branch|B=s' => \\$_branch,\n \t\t'no-checkout' => \\$_no_checkout,\n \t\t'quiet|q' => \\$_q,\n \t\t'repack-flags|repack-args|repack-opts=s' =>\n@@ -367,7 +368,7 @@ sub cmd_dcommit {\n \tmy $head = shift;\n \t$head ||= 'HEAD';\n \tmy @refs;\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs);\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs, $_branch);\n \tunless ($gs) {\n \t\tdie \"Unable to determine upstream SVN information from \",\n \t\t    \"$head history\\n\";\n@@ -441,7 +442,7 @@ sub cmd_find_rev {\n \t\tmy $head = shift;\n \t\t$head ||= 'HEAD';\n \t\tmy @refs;\n-\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs);\n+\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs, $_branch);\n \t\tunless ($gs) {\n \t\t\tdie \"Unable to determine upstream SVN information from \",\n \t\t\t    \"$head history\\n\";\n@@ -457,7 +458,7 @@ sub cmd_find_rev {\n \n sub cmd_rebase {\n \tcommand_noisy(qw/update-index --refresh/);\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n \tunless ($gs) {\n \t\tdie \"Unable to determine upstream SVN information from \",\n \t\t    \"working tree history\\n\";\n@@ -474,7 +475,7 @@ sub cmd_rebase {\n }\n \n sub cmd_show_ignore {\n-\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n+\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n \t$gs ||= Git::SVN->new;\n \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n \t$gs->traverse_ignore(\\*STDOUT, $gs->{path}, $r);\n@@ -801,12 +802,14 @@ sub cmt_metadata {\n }\n \n sub working_head_info {\n-\tmy ($head, $refs) = @_;\n+\tmy ($head, $refs, $grep) = @_;\n \tmy ($fh, $ctx) = command_output_pipe('rev-list', $head);\n \twhile (my $hash = <$fh>) {\n \t\tchomp($hash);\n \t\tmy ($url, $rev, $uuid) = cmt_metadata($hash);\n \t\tif (defined $url && defined $rev) {\n+\t\t\tnext unless (!$grep or\n+\t\t\t\t$url =~ m{$grep} or $uuid =~ m{$grep});\n \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n \t\t\t\tmy $c = $gs->rev_db_get($rev);\n \t\t\t\tif ($c && $c eq $hash) {\n@@ -3394,7 +3397,7 @@ sub git_svn_log_cmd {\n \t\tlast;\n \t}\n \n-\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head);\n+\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head, undef, $_branch);\n \t$gs ||= Git::SVN->_new;\n \tmy @cmd = (qw/log --abbrev-commit --pretty=raw --default/,\n \t           $gs->refname);\n-- \n1.5.2.0.45.gfea6d-dirty\n"},{"id":"44051","messageId":"20070605095608.GA8215@muzzle","threadId":"8434","inReplyTo":"4664E546.5060304@vilain.net","subject":"Re: [PATCH] git-svn: allow to specify svn branch for commands","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-05T09:56:08Z","receivedAt":"2007-06-05T09:56:08Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Sam Vilain <sam@vilain.net> wrote:\n> Eric Wong wrote:\n> > Sam Vilain <sam.vilain@catalyst.net.nz> wrote:\n> >> \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n> >> back merges.  Allow the user to specify which one is used, albeit in a\n> >> rather hack-ish way.\n> > \n> > Frightening...  Perhaps we should echo the final URL out\n> > to the user and prompt them for confirmation.\n> \n> Actually in between sending this to the list, I figured that it should\n> be possible to detect when this is happening, at the expense of an extra\n> \"git-log\" command.  Basically, take the first revision you found a\n> commitlog entry in, and then do a log from the indicated head excluding\n> that commit.  If you find more valid tips then the user is merging in\n> gitspace.\n> \n> Of course ideally you want to make sure that merge commits posted back\n> are shipped with all of the necessary tokens for the various SVN-land\n> tools out there.  eg, svk:merge, svnmerge, and whatever kooky system the\n> SVN dev team come up with.  But that's a separate issue.\n> \n> The original patch had a fairly dire bug, so here's a version that at\n> least doesn't break the test suite.\n> \n> Subject: [PATCH] git-svn: allow to specify svn branch for commands\n> \n> \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n> back merges.  Allow the user to specify which one is used, albeit in a\n> rather hack-ish way.\n\nActually, I believe 13c823fb520eaf1cded520213cf0ae4c3268208d already\nsolves this problem.  In fact, I'm not certain if you can find a case\nwhere this will help if 13c823fb520eaf1cded520213cf0ae4c3268208d is in\nplace.  A test case to prove that this is actually needed would be\ngreatly appreciated :)\n\nOn the other hand (much to my chagrin), I haven't been working much on\ngit-svn lately and my knowledge could be rusty.\n\n> ---\n> \n>  Documentation/git-svn.txt |   11 +++++++++++\n>  git-svn.perl              |   17 ++++++++++-------\n>  2 files changed, 21 insertions(+), 7 deletions(-)\n> \n> diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\n> index c0d7d95..3e64522 100644\n> --- a/Documentation/git-svn.txt\n> +++ b/Documentation/git-svn.txt\n> @@ -69,6 +69,17 @@ COMMANDS\n>  \targument if that is what you want.  This is useful if\n>  \tyou wish to track multiple projects that share a common\n>  \trepository.\n> +-B<svn_branch>;;\n> +--branch=<svn_branch>;;\n> +\tNormally, git-svn is capable of figuring out which branch you\n> +\tare working on.  However, if you are doing merges between svn\n> +\tbranches using git then the decision about which branch to\n> +\tdcommit to will end up being made based on which of the\n> +\tbranches you are merging has the newest upstream commit.  This\n> +\toption enables a global filter that tells git-svn what to look\n> +\tfor in the git-svn-id: line - specify a repository UUID or a\n> +\tbranch name here.  So, it may be used with \"git-svn log\",\n> +\t\"git-svn dcommit\", etc.\n\nI think you missed my comment here on it being a regexp :)\n\n>  'fetch'::\n>  \tFetch unfetched revisions from the Subversion remote we are\n> diff --git a/git-svn.perl b/git-svn.perl\n> index e350061..906aa4b 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -54,7 +54,7 @@ $sha1 = qr/[a-f\\d]{40}/;\n>  $sha1_short = qr/[a-f\\d]{4,40}/;\n>  my ($_stdin, $_help, $_edit,\n>  \t$_message, $_file,\n> -\t$_template, $_shared,\n> +\t$_template, $_shared, $_branch,\n>  \t$_version, $_fetch_all, $_no_rebase,\n>  \t$_merge, $_strategy, $_dry_run, $_local,\n>  \t$_prefix, $_no_checkout, $_verbose);\n> @@ -69,6 +69,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \\$Git::SVN::_follow_parent,\n>  \t\t'useSvmProps' => \\$Git::SVN::_use_svm_props,\n>  \t\t'useSvnsyncProps' => \\$Git::SVN::_use_svnsync_props,\n>  \t\t'log-window-size=i' => \\$Git::SVN::Ra::_log_window_size,\n> +\t\t'branch|B=s' => \\$_branch,\n>  \t\t'no-checkout' => \\$_no_checkout,\n>  \t\t'quiet|q' => \\$_q,\n>  \t\t'repack-flags|repack-args|repack-opts=s' =>\n> @@ -367,7 +368,7 @@ sub cmd_dcommit {\n>  \tmy $head = shift;\n>  \t$head ||= 'HEAD';\n>  \tmy @refs;\n> -\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs);\n> +\tmy ($url, $rev, $uuid, $gs) = working_head_info($head, \\@refs, $_branch);\n>  \tunless ($gs) {\n>  \t\tdie \"Unable to determine upstream SVN information from \",\n>  \t\t    \"$head history\\n\";\n> @@ -441,7 +442,7 @@ sub cmd_find_rev {\n>  \t\tmy $head = shift;\n>  \t\t$head ||= 'HEAD';\n>  \t\tmy @refs;\n> -\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs);\n> +\t\tmy (undef, undef, undef, $gs) = working_head_info($head, \\@refs, $_branch);\n>  \t\tunless ($gs) {\n>  \t\t\tdie \"Unable to determine upstream SVN information from \",\n>  \t\t\t    \"$head history\\n\";\n> @@ -457,7 +458,7 @@ sub cmd_find_rev {\n  \nI don't think you need this hunk.  You can already pass the remote\nbranch name here (same with \"git svn log\").\n\n>  sub cmd_rebase {\n>  \tcommand_noisy(qw/update-index --refresh/);\n> -\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n> +\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n>  \tunless ($gs) {\n>  \t\tdie \"Unable to determine upstream SVN information from \",\n>  \t\t    \"working tree history\\n\";\n> @@ -474,7 +475,7 @@ sub cmd_rebase {\n>  }\n>  \n>  sub cmd_show_ignore {\n> -\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD');\n> +\tmy ($url, $rev, $uuid, $gs) = working_head_info('HEAD', undef, $_branch);\n>  \t$gs ||= Git::SVN->new;\n>  \tmy $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);\n>  \t$gs->traverse_ignore(\\*STDOUT, $gs->{path}, $r);\n> @@ -801,12 +802,14 @@ sub cmt_metadata {\n>  }\n\nYou need to put --branch/-B into %cmd directly, %fc_opts won't cover\nthis ('fc' => fetch/commit).  On the other hand, we should probably make\nthis command take a $head from the command-line like \"git svn log\" and\n\"git svn find-rev\"...\n\n>  sub working_head_info {\n> -\tmy ($head, $refs) = @_;\n> +\tmy ($head, $refs, $grep) = @_;\n>  \tmy ($fh, $ctx) = command_output_pipe('rev-list', $head);\n>  \twhile (my $hash = <$fh>) {\n>  \t\tchomp($hash);\n>  \t\tmy ($url, $rev, $uuid) = cmt_metadata($hash);\n>  \t\tif (defined $url && defined $rev) {\n> +\t\t\tnext unless (!$grep or\n> +\t\t\t\t$url =~ m{$grep} or $uuid =~ m{$grep});\n>  \t\t\tif (my $gs = Git::SVN->find_by_url($url)) {\n>  \t\t\t\tmy $c = $gs->rev_db_get($rev);\n>  \t\t\t\tif ($c && $c eq $hash) {\n\nThis last 'if' statement here checking the rev_db (introduced in\n13c823fb520eaf1cded520213cf0ae4c3268208d still allows what\nthis patch is intended to do?\n\n> @@ -3394,7 +3397,7 @@ sub git_svn_log_cmd {\n>  \t\tlast;\n>  \t}\n>  \n> -\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head);\n> +\tmy ($url, $rev, $uuid, $gs) = ::working_head_info($head, undef, $_branch);\n>  \t$gs ||= Git::SVN->_new;\n>  \tmy @cmd = (qw/log --abbrev-commit --pretty=raw --default/,\n>  \t           $gs->refname);\n\nYou don't need this last hunk.   git svn log already takes\nremote branches as an argument, and I don't think the -B switch is\npassed here where you put it in %fc_opts.\n\n-- \nEric Wong\n"},{"id":"44052","messageId":"20070605095624.GA32225@muzzle","threadId":"8434","inReplyTo":"1181017002.27463.3.camel@megatron","subject":"Re: [PATCH] git-svn: allow to specify svn branch for commands","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-06-05T09:56:24Z","receivedAt":"2007-06-05T09:56:24Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Stephen Touset <stephen@touset.org> wrote:\n> On Tue, 2007-06-05 at 15:42 +1200, Sam Vilain wrote:\n> > \"git-svn dcommit\" ends up making an arbitrary decision when pushing\n> > back merges.  Allow the user to specify which one is used, albeit in a\n> > rather hack-ish way.\n> \n> I've been thinking about this. I'm rather new to git internals, but if\n> I've created a local copy of a remote branch (git-checkout -b\n> local-branch --track remote-branch), can't git-svn use the tracking\n> metadata to determine which part of the tree to dcommit to?\n\nProbably.  --track didn't exist when \"git-svn dcommit\" was written\nand I didn't even know about it until now.  Needless to say,\nnot everybody uses or knows about it, but it would probably be\na good option to add to git-svn.\n\n-- \nEric Wong\n"}]}