git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-svn: importing branches later
@ 2007-05-07 19:07 Michael Hendricks
  2007-05-08  8:51 ` Karl Hasselström
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Hendricks @ 2007-05-07 19:07 UTC (permalink / raw)
  To: git

I've cloned the trunk of a SVN repository using git-svn and now I want
to bring in just a couple of the branches from the same repository.
I've not been able to discover anything that works.  Basically, I've
done this

$ git svn clone $URL -T trunk git-repo

Now I want to import the 'foo' branch from the same SVN repo without
grabbing all the branches.  Any suggestions?

Thanks.

-- 
Michael

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

* Re: git-svn: importing branches later
  2007-05-07 19:07 git-svn: importing branches later Michael Hendricks
@ 2007-05-08  8:51 ` Karl Hasselström
  2007-05-08 14:51   ` Seth Falcon
  0 siblings, 1 reply; 4+ messages in thread
From: Karl Hasselström @ 2007-05-08  8:51 UTC (permalink / raw)
  To: git

On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:

> Now I want to import the 'foo' branch from the same SVN repo without
> grabbing all the branches. Any suggestions?

I seem to recall that just adding another "fetch" line to the git-svn
configuration in .git/config will do this for you.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

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

* Re: git-svn: importing branches later
  2007-05-08  8:51 ` Karl Hasselström
@ 2007-05-08 14:51   ` Seth Falcon
  2007-05-08 15:34     ` Michael Hendricks
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Falcon @ 2007-05-08 14:51 UTC (permalink / raw)
  To: git

Karl Hasselström <kha@treskal.com> writes:

> On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:
>
>> Now I want to import the 'foo' branch from the same SVN repo without
>> grabbing all the branches. Any suggestions?
>
> I seem to recall that just adding another "fetch" line to the git-svn
> configuration in .git/config will do this for you.

Yes, this should work.  As long as you started out with a fairly
recent git (sorry, I don't know how recent is needed) you should have
in your repository a git/config file containing something like:

    [svn-remote "svn"]
    	url = http://main.svn.url.com/
    	fetch = trunk:refs/remotes/git-svn
    	fetch = branches/b1:refs/remotes/b1  <-- this line added by you

Then a 'git svn fetch' should pull it all down and you can checkout
the branch using 'git checkout -b myb1 remotes/b1'.  At this point,
'git svn rebase' is smart enough to know where the branch comes from.

What may not work when you add branches in this way is that the
history may not connect with the actual branch commit in svn.  I'm
fairly sure there is some way to fix that, but I haven't done it.

+ seth

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

* Re: git-svn: importing branches later
  2007-05-08 14:51   ` Seth Falcon
@ 2007-05-08 15:34     ` Michael Hendricks
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Hendricks @ 2007-05-08 15:34 UTC (permalink / raw)
  To: git

On Tue, May 08, 2007 at 07:51:10AM -0700, Seth Falcon wrote:
> Karl Hasselström <kha@treskal.com> writes:
> 
> > On 2007-05-07 13:07:06 -0600, Michael Hendricks wrote:
> >
> >> Now I want to import the 'foo' branch from the same SVN repo without
> >> grabbing all the branches. Any suggestions?
> >
> > I seem to recall that just adding another "fetch" line to the git-svn
> > configuration in .git/config will do this for you.
> 
> Yes, this should work.  As long as you started out with a fairly
> recent git (sorry, I don't know how recent is needed) you should have
> in your repository a git/config file containing something like:
> 
>     [svn-remote "svn"]
>     	url = http://main.svn.url.com/
>     	fetch = trunk:refs/remotes/git-svn
>     	fetch = branches/b1:refs/remotes/b1  <-- this line added by you

Thanks Seth and Karl, that does indeed work.

I noticed that after changing .git/config and running fetch, git-svn
retrieves the log for the entire project (presumably because it doesn't
know when the new branch was created).  In one project with ~30,000
revisions, I found it beneficial to specify "git svn fetch -r
12345:HEAD" where revision 12345 is somewhere close to and before the
point at which the new branch was created from trunk.  That makes the
initial fetch must faster.

-- 
Michael

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

end of thread, other threads:[~2007-05-08 15:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-07 19:07 git-svn: importing branches later Michael Hendricks
2007-05-08  8:51 ` Karl Hasselström
2007-05-08 14:51   ` Seth Falcon
2007-05-08 15:34     ` Michael Hendricks

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).