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

Re: git svn: Supporting multiple branch subdirs?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Jun 17, 2009, 14:25 UTC
Message-ID
<4A38FCEE.2020002@drmicha.warpmail.net>
In-Reply-To
<4A368509.9070801@xiplink.com>
Marc Branchaud venit, vidit, dixit 15.06.2009 19:29:
Show 10 quoted lines
> Michael J Gruber wrote:
>>
>> After doing the init with "--branches=stable" (without releng), do
>> git config --add svn-remote.svn.branches 'releng/*:refs/remotes/*'
>>
>> This gives you two branches refspecs in .git/config (feel free to put
>> them in different dirs under remotes if there may be name clashes
>> between stable and releng branches).
> 
> That doesn't seem to work...

No, it doesn't I'm sorry. I knew that git-svn lumps multiple command line arguments into one, but it does so also for config lines. I didn't know that but confirmed from a test (and the source).

Now, one last resort would be a more complicated regexp. Unfortunately, something like

branches = (releng|stable)/*:refs/remotes/*/*
does not work (regexps don't work, only globs)
and something like
branches = */*:refs/remotes/*/*
works in principle but gets everything under head wrong.
Show 13 quoted lines
> 
> Here's my .git/config file before the first fetch:
> 
> [svn-remote "svn"]
>         useSvnsyncProps = 1
>         ignore-paths = ^[^/]+/(?:cvs2svn|projects|svnadmin|user|vendor.*)
>         url = file:///home/marcnarc/Code/FreeBSD-all-mirror/base
>         fetch = head:refs/remotes/trunk
>         branches = stable/*:refs/remotes/stable/*
>         branches = releng/*:refs/remotes/releng/*
>         tags = release/*:refs/remotes/tags/*
> 
> (Shouldn't that fetch line be head:refs/remots/head, since there's nothing called "trunk" in the svn repo?  I used git-svn init --trunk=head ...)

The left hand side of the refspec refers to the svn repo, the right hand side only names your local ref. Feel free to put "head" there, although this can be confused very easily with "HEAD" which has special meaning in git.

Show 7 quoted lines
>> I assume that git-svn converts such an svn commit into several git
>> commits, one for each affected branch. Since you have a local mirror
>> it's easy to try out.
> 
> Yep, git-svn does just that.  Nice!
> 
> 		M.
At least I got one thing right :)

I've used multiple svn-remote sections before (in cases where the repo structure changed) but I'm afraid this is of no use here. Looking at the source of git-svn, one sees that "tags" and "branches" are basically treated the same way, they are simply members of a "remote" struct/object/whatever it's called in perl and only differ in their standard refspec. Noone keeps us from adding "branches2" for a quick hack and checking whether everything stays sane... (git-svn perl often loops over "branches tags", that needs to be replaced).

In fact, I think the way to go would be replacing the two by an array. As a next step, the command line parsing and config reading needs to be changed so that multiple branches or tags entries end up generating multiple members of that array. Now this only needs to be implemented ;)

Michael

P.S.: Let me know if you give it a shot, so that we don't duplicate our waste of time...

Previous: Marc BranchaudNext: Marc Branchaud
Message 4 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.