git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about git-svn import
@ 2007-12-17 17:18 Pascal Obry
  2007-12-18  3:48 ` Steven Walter
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2007-12-17 17:18 UTC (permalink / raw)
  To: git list


Hi,

You'll find a script into this message that reproduce what I'll describe
below. Basically the Subversion repository add a given structure in the
past then rearranged to use the "standard" structure. The former
structure was:

   <root>
      |
      | - dir1
      | - dir2

The new one is:

   <root>
      |
      |- trunk
      |    | - dir1
      |    | - dir2
      |- branches
      |- tags

Now I want to import this project into Git (using git-svn) as the
project won't leave Subversion for the moment. When doing:

   $ git svn clone -s <repo> <git-repo>

In git-repo we get only the commits done inside <root>/trunk and not the
commits done in the former repository.

The question is what is the best way to deal with such a case with git-svn ?

Thanks.

############################ CUT HERE #############################
#!/bin/sh

REP=file://$(pwd)/repo

rm -fr repo co-repo git-repo

svnadmin create repo

svn co $REP co-repo
cd co-repo
mkdir dir
echo file1 > dir/file1
svn add dir dir/file1
svn ci -m "ci1" dir dir/file1

svn mkdir -m "create trunk" $REP/trunk
svn mkdir -m "create branches" $REP/branches
svn mkdir -m "create tags" $REP/tags

svn move -m "move dir under trunk" $REP/dir $REP/trunk/dir

svn update
sleep 2

echo file1 >> trunk/dir/file1
svn ci -m "ci2" trunk/dir/file1

sleep 2
svn update

cd ..

git svn clone -s $REP git-repo
############################ CUT HERE #############################

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

* Re: Question about git-svn import
  2007-12-17 17:18 Question about git-svn import Pascal Obry
@ 2007-12-18  3:48 ` Steven Walter
  2007-12-18  7:10   ` Pascal Obry
  0 siblings, 1 reply; 8+ messages in thread
From: Steven Walter @ 2007-12-18  3:48 UTC (permalink / raw)
  To: Pascal Obry; +Cc: git list

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

On Mon, Dec 17, 2007 at 06:18:29PM +0100, Pascal Obry wrote:
> You'll find a script into this message that reproduce what I'll describe
> below. Basically the Subversion repository add a given structure in the
> past then rearranged to use the "standard" structure. The former
> structure was:
> 
>    <root>
>       |
>       | - dir1
>       | - dir2
> 
> The new one is:
> 
>    <root>
>       |
>       |- trunk
>       |    | - dir1
>       |    | - dir2
>       |- branches
>       |- tags
> 
> Now I want to import this project into Git (using git-svn) as the
> project won't leave Subversion for the moment. When doing:
> 
>    $ git svn clone -s <repo> <git-repo>
> 
> In git-repo we get only the commits done inside <root>/trunk and not the
> commits done in the former repository.
> 
> The question is what is the best way to deal with such a case with git-svn ?

Not sure if this is the best way, but I would recommend cloning into two
repositories, then combining them.  So you already have the newer
changes with the standard layout.  You would now:

    $ git svn init <repo>

And only fetch the revisions before the layout change.  You could then
combine the two repositories using .git/info/grafts and
git-rewrite-branch.
-- 
-Steven Walter <stevenrwalter@gmail.com>
Freedom is the freedom to say that 2 + 2 = 4
B2F1 0ECC E605 7321 E818  7A65 FC81 9777 DC28 9E8F 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Question about git-svn import
  2007-12-18  3:48 ` Steven Walter
@ 2007-12-18  7:10   ` Pascal Obry
  2007-12-18 15:31     ` Jörg Sommer
  0 siblings, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2007-12-18  7:10 UTC (permalink / raw)
  To: Steven Walter; +Cc: git list

Steven Walter a écrit :
> Not sure if this is the best way, but I would recommend cloning into two
> repositories, then combining them.  

I feared that :)

> So you already have the newer
> changes with the standard layout.  You would now:
> 
>     $ git svn init <repo>
> 
> And only fetch the revisions before the layout change.  You could then
> combine the two repositories using .git/info/grafts and
> git-rewrite-branch.

Hum, looks like something not easy to do (at least for a Git beginner
like me) ! Any documentation on this ? Would you mind showing this on
the example script I sent ?

Thanks,
Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

* Re: Question about git-svn import
  2007-12-18  7:10   ` Pascal Obry
@ 2007-12-18 15:31     ` Jörg Sommer
  2007-12-19 11:29       ` Pascal Obry
  2007-12-20 16:30       ` Pascal Obry
  0 siblings, 2 replies; 8+ messages in thread
From: Jörg Sommer @ 2007-12-18 15:31 UTC (permalink / raw)
  To: git list

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

Hello Pascal,

Pascal Obry schrieb am Tue 18. Dec, 08:10 (+0100):
> Steven Walter a écrit :
> > Not sure if this is the best way, but I would recommend cloning into two
> > repositories, then combining them.  
> 
> I feared that :)

It's not as complicated as you might think.

> > So you already have the newer
> > changes with the standard layout.  You would now:
> > 
> >     $ git svn init <repo>
> > 
> > And only fetch the revisions before the layout change.  You could then
> > combine the two repositories using .git/info/grafts and
> > git-rewrite-branch.
> 
> Hum, looks like something not easy to do (at least for a Git beginner
> like me) ! Any documentation on this ? Would you mind showing this on
> the example script I sent ?

I had the same problem. We changed the structure of our SVN repository
from /trunk/pkg to /pkg/trunk and git-svn couldn't deal with this.

I used the script posted in
http://lists.alioth.debian.org/pipermail/pkg-jed-devel/2007-December/001719.html
to do the switch.

Some suggestions:
1. Import both parts into one git repo into their own branches. (use
   --prefix)

2. Use gitk to insprect the history to find bad commits, e.g. empty
   commits or things git-svn imported wrong.

3. Use git-filter-branch with the --parent-filter to join the branches.

HTH, Jörg.
-- 
Die am Lautesten reden, haben stets am wenigsten zu sagen.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Question about git-svn import
  2007-12-18 15:31     ` Jörg Sommer
@ 2007-12-19 11:29       ` Pascal Obry
  2007-12-20 16:30       ` Pascal Obry
  1 sibling, 0 replies; 8+ messages in thread
From: Pascal Obry @ 2007-12-19 11:29 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: git list

Jörg,

> It's not as complicated as you might think.

Ok, thanks for the pointers. I'll have a look.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

* Re: Question about git-svn import
  2007-12-18 15:31     ` Jörg Sommer
  2007-12-19 11:29       ` Pascal Obry
@ 2007-12-20 16:30       ` Pascal Obry
  2007-12-20 16:52         ` Jörg Sommer
  1 sibling, 1 reply; 8+ messages in thread
From: Pascal Obry @ 2007-12-20 16:30 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: git list

Jörg,

I have at least one remaining problem.

# Import old trunk into pre/master
$ git svn init svn+ssh://myserver --prefix=pre/ --trunk=importfromcvs/trunk
$ git svn fetch --revision=9458:10242

# Import new trunk into post/master
$ git config svn-remote.svn.fetch trunk/PROJ:refs/remotes/post/trunk
$ git svn fetch --revision=11058:11066

# Rewrite post/trunk on top of pre/trunk into merged-master
$ git checkout post/trunk
$ git checkout -b merged-master
$ git-filter-branch --tag-name-filter cat --parent-filter "sed -e
's/^$/-p $(git rev-parse pre/trunk)/'" merged-master

The problem is that at this point I cannot "git svn rebase". Looks like
the filter-branch command did break the link between the Subversion
repository and the git svn one:

$ git svn rebase
Unable to determine upstream SVN information from working tree history

Is there a way around that ?

Thanks,
Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

* Re: Question about git-svn import
  2007-12-20 16:30       ` Pascal Obry
@ 2007-12-20 16:52         ` Jörg Sommer
  2007-12-21 13:11           ` Pascal Obry
  0 siblings, 1 reply; 8+ messages in thread
From: Jörg Sommer @ 2007-12-20 16:52 UTC (permalink / raw)
  To: git list

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

Pascal Obry schrieb am Thu 20. Dec, 17:30 (+0100):
> # Rewrite post/trunk on top of pre/trunk into merged-master
> $ git checkout post/trunk
> $ git checkout -b merged-master
> $ git-filter-branch --tag-name-filter cat --parent-filter "sed -e
> 's/^$/-p $(git rev-parse pre/trunk)/'" merged-master
> 
> The problem is that at this point I cannot "git svn rebase". Looks like
> the filter-branch command did break the link between the Subversion
> repository and the git svn one:
> 
> $ git svn rebase
> Unable to determine upstream SVN information from working tree history
> 
> Is there a way around that ?

According to http://duncan.mac-vicar.com/blog/archives/282 it should help
to do something like:

git update-ref refs/remotes/git-svn master
find -name .rev_db* | xargs rm

I didn't had this problem, because I did a one‐time import.

Bye, Jörg.
-- 
Die zehn Gebote Gottes enthalten 172 Wörter, die amerikanische
Unabhängigkeitserklärung 300 Wörter, die Verordnung der europäischen
Gemeinschaft über den Import von Karamelbonbons exakt 25911 Wörter.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Question about git-svn import
  2007-12-20 16:52         ` Jörg Sommer
@ 2007-12-21 13:11           ` Pascal Obry
  0 siblings, 0 replies; 8+ messages in thread
From: Pascal Obry @ 2007-12-21 13:11 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: git list

Jörg Sommer a écrit :
> According to http://duncan.mac-vicar.com/blog/archives/282 it should help
> to do something like:
> 
> git update-ref refs/remotes/git-svn master
> find -name .rev_db* | xargs rm

Ok, thanks a lot it is working!

Git is a great tool... and the community around it is really helpful.
Thanks to all!

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17 17:18 Question about git-svn import Pascal Obry
2007-12-18  3:48 ` Steven Walter
2007-12-18  7:10   ` Pascal Obry
2007-12-18 15:31     ` Jörg Sommer
2007-12-19 11:29       ` Pascal Obry
2007-12-20 16:30       ` Pascal Obry
2007-12-20 16:52         ` Jörg Sommer
2007-12-21 13:11           ` Pascal Obry

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