git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Git SVN non-standard branch/tag/trunk layout
@ 2010-12-12 21:35 Albert Krawczyk
  2010-12-13  0:25 ` Andreas Schwab
  2010-12-13 14:23 ` Stephen Bash
  0 siblings, 2 replies; 6+ messages in thread
From: Albert Krawczyk @ 2010-12-12 21:35 UTC (permalink / raw)
  To: git

Hi all,

One of the SVN repositories that I work with (and have a Git version of) has
recently implemented a tag/trunk/branch layout, and I'd like to update my
repository to correctly work with this layout. 

As far as I understand the standard layout for a SVN repo that supports
branching is 

SVR Root ----Trunk - folders/files
 \
  --Branch - folders/files
  \
   -Tag - folders/files

With each of those having the project contents

The SVN repo I am now faced with has the trunk/branch/tag folders on
selected folders in the tree.

Essentially instead of having one project per repo, there are multiple
projects in the repo. So the repo looks like this

---SVN Root --- Folder(Proj1) ---- Files
	\
	 ---- Folder(Proj2) --- Trunk - Files
	|	       \
	|		- Branch - Files
	|		|
	|		- Tag - ...
	|
	|- Proj3 - Files
	|- Proj4 - Trunk
		 |-Branch
		 | - Tag

The question is, is there a way I can get Git SVN to understand and
replicate this layout in a git repo? I don't mind if I have to import the
entire repo again into git. 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git SVN non-standard branch/tag/trunk layout
  2010-12-12 21:35 Git SVN non-standard branch/tag/trunk layout Albert Krawczyk
@ 2010-12-13  0:25 ` Andreas Schwab
  2010-12-13  0:55   ` Albert Krawczyk
  2010-12-13 14:23 ` Stephen Bash
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2010-12-13  0:25 UTC (permalink / raw)
  To: Albert Krawczyk; +Cc: git

"Albert Krawczyk" <pro-logic@optusnet.com.au> writes:

> Essentially instead of having one project per repo, there are multiple
> projects in the repo. So the repo looks like this
>
> ---SVN Root --- Folder(Proj1) ---- Files
> 	\
> 	 ---- Folder(Proj2) --- Trunk - Files
> 	|	       \
> 	|		- Branch - Files
> 	|		|
> 	|		- Tag - ...
> 	|
> 	|- Proj3 - Files
> 	|- Proj4 - Trunk
> 		 |-Branch
> 		 | - Tag
>
> The question is, is there a way I can get Git SVN to understand and
> replicate this layout in a git repo? I don't mind if I have to import the
> entire repo again into git. 

If they are multiple projects then you'll probably be better off
importing each project into its own git repository.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Git SVN non-standard branch/tag/trunk layout
  2010-12-13  0:25 ` Andreas Schwab
@ 2010-12-13  0:55   ` Albert Krawczyk
  0 siblings, 0 replies; 6+ messages in thread
From: Albert Krawczyk @ 2010-12-13  0:55 UTC (permalink / raw)
  Cc: git

Andreas Schwab [mailto:schwab@linux-m68k.org]

> If they are multiple projects then you'll probably be better off 
> importing each project into its own git repository.
> 
> Andreas.

Yes, this is probably the 'better' way of dealing with it, and it works
fine. I was however wondering if there was a way to track the root of the
SVN directory with the structure I supplied earlier while maintaining a
'nice' structure in Git without having /trunk/, /branch/, /tag/
subdirectories appearing directly in the repository as standard folders. My
(extremely limited) understanding is that I would need to edit the config
file, specifically the fetch, branches and tags section of svn-remote. But I
am unsure of how this modified section would look like. 

Albert

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git SVN non-standard branch/tag/trunk layout
  2010-12-12 21:35 Git SVN non-standard branch/tag/trunk layout Albert Krawczyk
  2010-12-13  0:25 ` Andreas Schwab
@ 2010-12-13 14:23 ` Stephen Bash
  2010-12-13 21:08   ` Albert Krawczyk
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Bash @ 2010-12-13 14:23 UTC (permalink / raw)
  To: Albert Krawczyk; +Cc: git

----- Original Message -----
> From: "Albert Krawczyk" <pro-logic@optusnet.com.au>
> To: git@vger.kernel.org
> Sent: Sunday, December 12, 2010 4:35:34 PM
> Subject: Git SVN non-standard branch/tag/trunk layout
> 
> The SVN repo I am now faced with has the trunk/branch/tag folders on
> selected folders in the tree.
> 
> Essentially instead of having one project per repo, there are multiple
> projects in the repo. So the repo looks like this
> 
> ---SVN Root --- Folder(Proj1) ---- Files
> \
> ---- Folder(Proj2) --- Trunk - Files
> |	       \
> |		- Branch - Files
> |		|
> |		- Tag - ...
> |
> |- Proj3 - Files
> |- Proj4 - Trunk
> |-Branch
> | - Tag
> 
> The question is, is there a way I can get Git SVN to understand and
> replicate this layout in a git repo? I don't mind if I have to import
> the entire repo again into git.

When I have to deal with non-standard SVN layouts I do the following:
 1) git svn init tgtDir
 2) Edit the config file (see below)
 3) cd tgtDir
 4) git svn fetch

Basically the svn-remote section of the config file allows you to play games with the translation of SVN paths to Git branches.  Basically each line is of the form svnPath:gitRef.

'fetch' lines are fixed SVN paths that map to a fixed Git ref.  You can have zero or more fetch lines as long as the Git refs are unambiguous (add to the static portion of each ref name to make it unambiguous).  

'branches' and 'tags' lines are each allowed to have a single asterisk (*) on either side of the colon (:) that acts like a wildcard -- the SVN directory name at the position of the asterisk will take the place of the asterisk on the right hand side (which must be the end of the line).  Again, you can have zero or more of each of these as long as the left hand side of each is unambiguous.

So taking a SWAG at your project layout (I'm assuming 'Branch' is the actual branch name, not a directory called 'Branch', similar for 'Tag', and I don't know where proj3 and proj4 are -- are they under Proj2 or back in the SVN root?):

[svn-remote "svn"]
        url = http://server.org/svn

        # Project 1 (note use of the name 'trunk' in Git is a personal choice)
        fetch = proj1:refs/remotes/proj1/trunk

        # Project 2
        branches = proj2/*:refs/remotes/proj2/*

        # Project 3 (note use of the name 'trunk' in Git is a personal choice)
        fetch = proj3:refs/remotes/proj3/trunk

        # Project 4 (note use of the name 'trunk' in Git is a personal choice)
        fetch = proj4/trunk:refs/remotes/proj4/trunk

        # etc...

Project 2 is an interesting one because it looks like the trunk is at the same level as branches/tags.  If that's the case, the 'branches' line above will work (it will treat the trunk like any other branch -- a very Git-like approach).  Also note that those projects that didn't have a 'trunk' directory in SVN I added a 'trunk' on the Git side to keep things consistent -- this is completely optional.

Once you get comfortable with the rules governing the config lines, you can pretty much untangle any SVN layout.

HTH,
Stephen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Git SVN non-standard branch/tag/trunk layout
  2010-12-13 14:23 ` Stephen Bash
@ 2010-12-13 21:08   ` Albert Krawczyk
  2010-12-13 21:23     ` Stephen Bash
  0 siblings, 1 reply; 6+ messages in thread
From: Albert Krawczyk @ 2010-12-13 21:08 UTC (permalink / raw)
  To: 'Stephen Bash'; +Cc: git

>Project 2 is an interesting one because it looks like the trunk is at the same level as branches/tags.  If that's the case, the 'branches' line above will work (it will treat >the trunk like any other branch -- a very Git-like approach).  Also note that those projects that didn't have a 'trunk' directory in SVN I added a 'trunk' on the Git side to >keep things consistent -- this is completely optional.
>
>Once you get comfortable with the rules governing the config lines, you can pretty much untangle any SVN layout.
>
>HTH,
>Stephen

Hi Stephen,

Thanks a lot! I thought this is what I had to do, and had through trial and (a lot of) error got to be very close. As far as I can see the only 'downside' of this approach is that you can't have the 'root' of the SVN repo checked out, you can only have the root of each project checked out, as they are all on their own ref. 

Thanks again for clarifying that,
Albert 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Git SVN non-standard branch/tag/trunk layout
  2010-12-13 21:08   ` Albert Krawczyk
@ 2010-12-13 21:23     ` Stephen Bash
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Bash @ 2010-12-13 21:23 UTC (permalink / raw)
  To: Albert Krawczyk; +Cc: git

----- Original Message -----
> From: "Albert Krawczyk" <pro-logic@optusnet.com.au>
> To: "Stephen Bash" <bash@genarts.com>
> Cc: git@vger.kernel.org
> Sent: Monday, December 13, 2010 4:08:28 PM
> Subject: RE: Git SVN non-standard branch/tag/trunk layout
>
> >Project 2 is an interesting one because it looks like the trunk is at
> >the same level as branches/tags. If that's the case, the 'branches'
> >line above will work (it will treat >the trunk like any other branch
> >-- a very Git-like approach). Also note that those projects that
> >didn't have a 'trunk' directory in SVN I added a 'trunk' on the Git
> >side to keep things consistent -- this is completely optional.
> >
> >Once you get comfortable with the rules governing the config lines,
> >you can pretty much untangle any SVN layout.
> 
> Thanks a lot! I thought this is what I had to do, and had through
> trial and (a lot of) error got to be very close. As far as I can see
> the only 'downside' of this approach is that you can't have the 'root'
> of the SVN repo checked out, you can only have the root of each
> project checked out, as they are all on their own ref.

I hadn't thought about it until now, but you could probably specify fetch=/:refs/remotes/svnroot to have a ref that is the root of the SVN repository...  Might be worth a shot...

Stephen

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-13 21:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-12 21:35 Git SVN non-standard branch/tag/trunk layout Albert Krawczyk
2010-12-13  0:25 ` Andreas Schwab
2010-12-13  0:55   ` Albert Krawczyk
2010-12-13 14:23 ` Stephen Bash
2010-12-13 21:08   ` Albert Krawczyk
2010-12-13 21:23     ` Stephen Bash

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).