git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git svn: Support multiple branch and tag paths in the svn repository.

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Jun 26, 2009, 19:20 UTC
Message-ID
<4A451F8A.9060501@xiplink.com>
In-Reply-To
<20090625093602.GA3997@dcvr.yhbt.net>
Thanks a bunch, Eric!
Can I assume that since you've taken the commit into your repo that the feature will find itself into Junio's git at some point?
I'll send out a documentation patch shortly.
Is the svn_cmd wrapper simply a drop-in replacement for svn?  I can make that change, too.
		M.
Eric Wong wrote:
Show 68 quoted lines
> Marc Branchaud <marcnarc@xiplink.com> wrote:
>> This enables git-svn.perl to read multiple 'branches' and 'tags' entries in
>> svn-remote config sections.  The init and clone subcommands also support
>> multiple --branches and --tags arguments.
>>
>> The branch (and tag) subcommand gets a new argument: --destination (or -d).
>> This argument is required if there are multiple branches (or tags) entries
>> configured for the remote Subversion repository.  The argument's value
>> specifies which branch (or tag) path to use to create the branch (or tag).
>> The specified value must match the left side (without wildcards) of one of
>> the branches (or tags) refspecs in the svn-remote's config.
>>
>> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
>> ---
>>
>> I got carried away making unit tests and went and implemented most of this...
>>
>> I'm fairly happy with this, except for the way the branch subcommand matches
>> refspecs.  The patch does a simple string comparison, but it'd be better to do
>> an actual glob.  I just couldn't track down the right function for that, so I
>> left it as a strcmp and hope that a gitizen can tell me how to glob here.
>>
>> (ps. I'm trying a new way to send patches -- apologies if it's mangled!)
> 
> Thanks Marc!  Everything looks fine here; I don't think I'll have time
> to test it myself any time soon but your test case looks good and
> doesn't break any of the other tests :)  Sorry for the delay, I haven't
> had access to my computer or email much in the past few weeks.
> 
> Acked and and pushed out to git://git.bogomips.org/git-svn along with a
> followup patch to convert the glob to a regexp for branching:
> 
> From f7050599310c18bd67b35b8d59486116b30ff1f6 Mon Sep 17 00:00:00 2001
> From: Eric Wong <normalperson@yhbt.net>
> Date: Thu, 25 Jun 2009 02:28:15 -0700
> Subject: [PATCH] git-svn: convert globs to regexps for branch destinations
> 
> Marc Branchaud wrote:
>> I'm fairly happy with this, except for the way the branch
>> subcommand matches refspecs.  The patch does a simple string
>> comparison, but it'd be better to do an actual glob.  I just
>> couldn't track down the right function for that, so I left it as
>> a strcmp and hope that a gitizen can tell me how to glob here.
> 
> Signed-off-by: Eric Wong <normalperson@yhbt.net>
> ---
> 
>  I haven't actually tested it, and yes, it should probably be
>  moved to Git.pm even though it's not necessarily git-only...
> 
>  git-svn.perl |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 48e8aad..6c42e2a 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -646,7 +646,9 @@ sub cmd_branch {
>  		            " with the --destination argument.\n";
>  		}
>  		foreach my $g (@{$allglobs}) {
> -			if ($_branch_dest eq $g->{path}->{left}) {
> +			# SVN::Git::Editor could probably be moved to Git.pm..
> +			my $re = SVN::Git::Editor::glob2pat($g->{path}->{left});
> +			if ($_branch_dest =~ /$re/) {
>  				$glob = $g;
>  				last;
>  			}
Previous: Eric WongNext: Marc Branchaud
Message 17 of 23 in “git svn: Supporting multiple branch subdirs?”
  1. Marc BranchaudJun 12, 2009
  2. Michael J GruberJun 13, 2009
  3. Marc BranchaudJun 15, 2009
  4. Michael J GruberJun 17, 2009
  5. Marc BranchaudJun 17, 2009
  6. Michael J GruberJun 18, 2009
  7. Marc BranchaudJun 18, 2009
  8. Michael J GruberJun 18, 2009
  9. git-svn: allow two branch configurationsMichael J Gruber, Jun 18, 2009
  10. Marc BranchaudJun 22, 2009
  11. git svn: Support multiple branch and tag paths in the svn repository.Marc Branchaud, Jun 23, 2009
  12. Eric WongJun 25, 2009
  13. Junio C HamanoJun 25, 2009
  14. Eric WongJun 26, 2009
  15. Andreas EricssonJun 26, 2009
  16. Eric WongJun 26, 2009
  17. Marc BranchaudJun 26, 2009
  18. git svn: Doc update for multiple branch and tag pathsMarc Branchaud, Jun 26, 2009
  19. Eric WongJun 26, 2009
  20. git svn: Fix t9138-multiple-branches to use svn_cmd and (cd ...) syntax.Marc Branchaud, Jun 26, 2009
  21. Eric WongJun 26, 2009
  22. Marc BranchaudJun 27, 2009
  23. Eric WongJun 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.