* git-svn-Cloning repository with complicate nesting
@ 2009-08-27 8:32 Daniele Segato
2009-09-03 14:31 ` Marc Branchaud
0 siblings, 1 reply; 4+ messages in thread
From: Daniele Segato @ 2009-08-27 8:32 UTC (permalink / raw)
To: Git Mailing List
Hi, this is my first message in the list: this may be a newbie
question and my English may not be very good.
I've an SVN repository structured like this:
http://<url>/path/to/repo
|
HEAD
|----- root
|
BRANCHES
|----- V1.0
| |----- root
|
|----- V1.1
| |----- root
|
|----- V1.2
| |----- root
|
|----- DEV
| |----- FEATURE1
| | |----- root
| |
| |----- FEATURE2
| | |----- root
| |
| |----- FEATURE3
| |----- root
|
|----- BUILDS
|----- BUILD1
| |----- root
|
|----- BUILD2
| |----- root
|
|----- BUILD3
|----- root
the same for TAGS.
I did this:
git init
git svn init <url>
vim .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = <url>
fetch = <url>/HEAD/root:refs/remotes/trunk
branches = <url>/BRANCHES/*/root:refs/remotes/branches/*
branches = <url>/BRANCHES/*/*/root:refs/remotes/devel/*
tags = <url>/TAGS/*/root:refs/remotes/tags/*
git svn fetch
It is now cloning the repo (it is a really big repo)
It is my configuration ok for the repository structure?
if from another terminal I execute "git branch -r" I get:
tags/V1.3.0
tags/V1.3.0@3260
tags/V1.3.1
tags/V1.3.1@3359
tags/V1.3.2
tags/V1.3.2@4256
tags/V1.4.0-COMMUNITY-FINAL
tags/V1.4.0-ENTERPRISE-BETA@4241
trunk
trunk@4475
It should have already created some branch but I don't see any...
what are those @XXXX number for some of those branches?
Is the syntax of the svn-remote configuration correct?
with this:
branches = <url>/BRANCHES/*/*/root:refs/remotes/devel/*
how does git choose the name of the branch? (
refs/remotes/devel/WHAT_GOES_HERE ? )
I would like it to use the tuple */* of the directory
If the syntax of my configuration is not correct, where can I found a
documentation about it? I couldn't find one.
Thanks
Regards,
Daniele
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-svn-Cloning repository with complicate nesting
2009-08-27 8:32 git-svn-Cloning repository with complicate nesting Daniele Segato
@ 2009-09-03 14:31 ` Marc Branchaud
2009-09-03 16:17 ` Daniele Segato
0 siblings, 1 reply; 4+ messages in thread
From: Marc Branchaud @ 2009-09-03 14:31 UTC (permalink / raw)
To: Daniele Segato; +Cc: Git Mailing List
Hi Daniele,
I think you're stuck. Someone who knows git-svn better than I might be able to figure out a solution (I haven't played with using wildcards in the middle of branches refspecs), but as far as I can tell git-svn can't support your repository's structure.
The fundamental problem is that the BRANCHES/ hierarchy isn't consistent. git-svn expects the directories under a 'branches' path to be branch names. In your case, you can't specify a configuration that covers your whole repository.
This:
branches = <url>/BRANCHES/DEV/*:refs/remotes/svn/dev/*
branches = <url>/BRANCHES/BUILDS/*:refs/remotes/svn/builds/*
will let you track the stuff under BRANCHES/DEV and BRANCHES/BUILDS, but won't let you see the V*.* branches.
This:
branches = <url>/BRANCHES/*:refs/remotes/svn/*
will let you see the V*.* branches, but will get confused over the DEV and BUILDS stuff (because it's expecting the layout to be DEV/root and BUILDS/root).
So I think git-svn would need to be modified to support your situation.
One possible approach is to make git-svn smart about what it considers a branch's name. In theory, what you'd like is to just specify
branches = <url>/BRANCHES/*:refs/remotes/svn/*
and have git-svn properly identify all the branches:
V1.0
V1.1
V1.2
DEV/FEATURE1
DEV/FEATURE2
DEV/FEATURE3
BUILDS/BUILD1
BUILDS/BUILD2
BUILDS/BUILD3
To do this, git-svn could track the current 'trunk' directory structure (just the top-level contents of the root should suffice). Then when it detects a new path under BRANCHES it could search through that path until it finds the same 'trunk' directory structure, and then use the path as the full branch name.
For example, say a repository's trunk has 3 directories and a file:
trunk/
foo/...
bar/...
baz/...
readme.txt
When a commit creates a new branch:
branches/some/path/
foo/...
bar/...
baz/...
readme.txt
git-svn sees that the commit is to a new path under branches/ and looks through branches/some/ and branches/some/path/ to find the trunk's contents, deciding in this case that 'some/path' is the branch's name.
Anyway, this is just an idea of how things might work. There are probably some corner-cases that could make this a bit tricky to implement...
M.
Daniele Segato wrote:
> Hi, this is my first message in the list: this may be a newbie
> question and my English may not be very good.
>
> I've an SVN repository structured like this:
>
> http://<url>/path/to/repo
> |
> HEAD
> |----- root
> |
> BRANCHES
> |----- V1.0
> | |----- root
> |
> |----- V1.1
> | |----- root
> |
> |----- V1.2
> | |----- root
> |
> |----- DEV
> | |----- FEATURE1
> | | |----- root
> | |
> | |----- FEATURE2
> | | |----- root
> | |
> | |----- FEATURE3
> | |----- root
> |
> |----- BUILDS
> |----- BUILD1
> | |----- root
> |
> |----- BUILD2
> | |----- root
> |
> |----- BUILD3
> |----- root
>
> the same for TAGS.
>
> I did this:
>
> git init
> git svn init <url>
> vim .git/config
>
> [core]
> repositoryformatversion = 0
> filemode = true
> bare = false
> logallrefupdates = true
> [svn-remote "svn"]
> url = <url>
> fetch = <url>/HEAD/root:refs/remotes/trunk
> branches = <url>/BRANCHES/*/root:refs/remotes/branches/*
> branches = <url>/BRANCHES/*/*/root:refs/remotes/devel/*
> tags = <url>/TAGS/*/root:refs/remotes/tags/*
>
>
> git svn fetch
>
>
> It is now cloning the repo (it is a really big repo)
>
>
> It is my configuration ok for the repository structure?
>
> if from another terminal I execute "git branch -r" I get:
> tags/V1.3.0
> tags/V1.3.0@3260
> tags/V1.3.1
> tags/V1.3.1@3359
> tags/V1.3.2
> tags/V1.3.2@4256
> tags/V1.4.0-COMMUNITY-FINAL
> tags/V1.4.0-ENTERPRISE-BETA@4241
> trunk
> trunk@4475
>
> It should have already created some branch but I don't see any...
>
> what are those @XXXX number for some of those branches?
>
> Is the syntax of the svn-remote configuration correct?
>
> with this:
> branches = <url>/BRANCHES/*/*/root:refs/remotes/devel/*
> how does git choose the name of the branch? (
> refs/remotes/devel/WHAT_GOES_HERE ? )
>
> I would like it to use the tuple */* of the directory
>
>
> If the syntax of my configuration is not correct, where can I found a
> documentation about it? I couldn't find one.
>
>
> Thanks
> Regards,
> Daniele
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-svn-Cloning repository with complicate nesting
2009-09-03 14:31 ` Marc Branchaud
@ 2009-09-03 16:17 ` Daniele Segato
2009-09-03 16:50 ` Marc Branchaud
0 siblings, 1 reply; 4+ messages in thread
From: Daniele Segato @ 2009-09-03 16:17 UTC (permalink / raw)
To: Marc Branchaud; +Cc: Git Mailing List
On Thu, Sep 3, 2009 at 4:31 PM, Marc Branchaud<marcnarc@xiplink.com> wrote:
> Hi Daniele,
Hi Marc and thank you for your reply.
> I think you're stuck. Someone who knows git-svn better than I might be able to figure out a solution (I haven't played with using wildcards in the middle of branches refspecs), but as far as I can tell git-svn can't support your repository's structure.
>
> The fundamental problem is that the BRANCHES/ hierarchy isn't consistent. git-svn expects the directories under a 'branches' path to be branch names. In your case, you can't specify a configuration that covers your whole repository.
yes..
and developers should be smart enought to keep consistency on their
own.. unfurtunately they oftern aren't
> So I think git-svn would need to be modified to support your situation.
I'm not feeling that lucky but I would be happy about it. :-)
> One possible approach is to make git-svn smart about what it considers a branch's name. In theory, what you'd like is to just specify
> To do this, git-svn could track the current 'trunk' directory structure (just the top-level contents of the root should suffice). Then when it detects a new path under BRANCHES it could search through that path until it finds the same 'trunk' directory structure, and then use the path as the full branch name.
> When a commit creates a new branch:
> git-svn sees that the commit is to a new path under branches/ and looks through branches/some/ and branches/some/path/ to find the trunk's contents, deciding in this case that 'some/path' is the branch's name.
>
> Anyway, this is just an idea of how things might work. There are probably some corner-cases that could make this a bit tricky to implement...
hum...
It could be an idea but I don't know how hard could it be to check it:
how much deep inside the tree should Git search for branch? what if
there are branches that are completely differents?
may be the user could create and pass a "branch model" to git svn to
make it able to decide what is a branch and what isn't.
I think there are many options
In my case It would have worked defining a structure like:
BRANCHES/*/root -> remote/svn/branch/*
BRANCHES/*/*/root -> remote/svn/branch/*/*
But it would be better with something like:
BRANCHES/\([^\/]+\)/root -> remote/svn/branch/$1
BRANCHES/\([^\/]+\)/\([^\/]+\)/root -> remote/svn/branch/$1/$2
like a grouped regex.
every branch not matching the regex will be skipped..
only an idea.. It couln't work in every situation but it would allow a
greater degree of freedom in the configuration.
I don't know if Git developers are interested in thinking on some
features like this.. it sound like an SVN-only hack to me.
Regards,
Daniele
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: git-svn-Cloning repository with complicate nesting
2009-09-03 16:17 ` Daniele Segato
@ 2009-09-03 16:50 ` Marc Branchaud
0 siblings, 0 replies; 4+ messages in thread
From: Marc Branchaud @ 2009-09-03 16:50 UTC (permalink / raw)
To: Daniele Segato; +Cc: Git Mailing List
Daniele Segato wrote:
>
> hum...
> It could be an idea but I don't know how hard could it be to check it:
> how much deep inside the tree should Git search for branch?
Well, as far as it takes. Actually, the search should be fairly well constrained. After checking that the entries under a particular path aren't a copy of the trunk, each entry can only represent either a branch that git-svn already knows about, or a new branch.
> what if there are branches that are completely differents?
Not sure what you mean there. Can you come up with an example of this?
> may be the user could create and pass a "branch model" to git svn to
> make it able to decide what is a branch and what isn't.
>
> I think there are many options
>
> In my case It would have worked defining a structure like:
> BRANCHES/*/root -> remote/svn/branch/*
> BRANCHES/*/*/root -> remote/svn/branch/*/*
>
> But it would be better with something like:
> BRANCHES/\([^\/]+\)/root -> remote/svn/branch/$1
> BRANCHES/\([^\/]+\)/\([^\/]+\)/root -> remote/svn/branch/$1/$2
>
> like a grouped regex.
>
> every branch not matching the regex will be skipped..
> only an idea.. It couln't work in every situation but it would allow a
> greater degree of freedom in the configuration.
Turning the branch refspecs into true regular expressions sounds like a good idea to me, and would probably be easier to implement than the trunk-detection stuff I proposed. Though there'd have to be a way to stay compatible with or upgrade the current non-regex refspecs.
> I don't know if Git developers are interested in thinking on some
> features like this.. it sound like an SVN-only hack to me.
All of git-svn is already a hack for dealing with SVN. :) I'm sure a patch for this would be welcome.
M.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-03 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-27 8:32 git-svn-Cloning repository with complicate nesting Daniele Segato
2009-09-03 14:31 ` Marc Branchaud
2009-09-03 16:17 ` Daniele Segato
2009-09-03 16:50 ` Marc Branchaud
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 NNTP newsgroup(s).