From: Eric Wong Date: Tue, 05 Jun 2007 04:14:47 GMT Subject: Re: [PATCH] git-svn: allow to specify svn branch for commands Message-ID: <20070605041446.GA4266@untitled> In-Reply-To: <1181014957993-git-send-email-sam.vilain@catalyst.net.nz> Sam Vilain wrote: > "git-svn dcommit" ends up making an arbitrary decision when pushing > back merges. Allow the user to specify which one is used, albeit in a > rather hack-ish way. Frightening... Perhaps we should echo the final URL out to the user and prompt them for confirmation. > --- > Documentation/git-svn.txt | 11 +++++++++++ > git-svn.perl | 16 +++++++++------- > 2 files changed, 20 insertions(+), 7 deletions(-) > > diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt > index c0d7d95..3e64522 100644 > --- a/Documentation/git-svn.txt > +++ b/Documentation/git-svn.txt > @@ -69,6 +69,17 @@ COMMANDS > argument if that is what you want. This is useful if > you wish to track multiple projects that share a common > repository. > +-B;; > +--branch=;; > + Normally, git-svn is capable of figuring out which branch you > + are working on. However, if you are doing merges between svn > + branches using git then the decision about which branch to > + dcommit to will end up being made based on which of the > + branches you are merging has the newest upstream commit. This > + option enables a global filter that tells git-svn what to look > + for in the git-svn-id: line - specify a repository UUID or a > + branch name here. So, it may be used with "git-svn log", > + "git-svn dcommit", etc. This should clarify that a Perl regular expression is used. '.' can match '-' or '_' which is also pretty common in version numbers. Perhaps give an -F(ixed-string) option like grep does? > sub working_head_info { > - my ($head, $refs) = @_; > + my ($head, $refs, $grep) = @_; > my ($fh, $ctx) = command_output_pipe('rev-list', $head); > while (my $hash = <$fh>) { > chomp($hash); > my ($url, $rev, $uuid) = cmt_metadata($hash); > + next unless (!$grep or $url =~ m{$grep} or $uuid =~ m{$grep}); > @@ -3394,7 +3396,7 @@ sub git_svn_log_cmd { -- Eric Wong