git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Split a subversion repo into several git repos
@ 2007-10-11 12:51 Eivind LM
  2007-10-11 13:24 ` Patrick Doyle
  2007-10-11 13:46 ` Jonathan del Strother
  0 siblings, 2 replies; 11+ messages in thread
From: Eivind LM @ 2007-10-11 12:51 UTC (permalink / raw
  To: git

Hi,
I would like to convert a subversion repository to Git. The subversion  
repository used to track development of several projects (only slightly  
related), and I would like to divide the repository into several smaller  
git repositories.

For example, I want to convert one subversion repository which contains  
the folders:
trunk/projectA
trunk/projectB

into two git repositories:
projectA.git
projectB.git

As far as I have understood, the way to do this is to
1) Convert the entire subversion repository to git with git-svn.
2) Make two copies of the whole new git-repository (projectA.git and  
projectB.git).
3) Use git-rm to remove projectB from projectA.git, and projectA from  
projectB.git.

This works fine, but both git-repositories now carries the history for  
both projects. If possible, I would like to "clean" the history in the  
repositories, so that I don't see history information for projectA when I  
am browsing logs in projectB.git. Has anyone been in the same situation?  
Do you have suggestions on how it can be solved?

Any help will be greatly appreciated.

Thanks,
Eivind

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

* Re: Split a subversion repo into several git repos
  2007-10-11 12:51 Split a subversion repo into several git repos Eivind LM
@ 2007-10-11 13:24 ` Patrick Doyle
  2007-10-12 14:15   ` Eivind LM
  2007-10-11 13:46 ` Jonathan del Strother
  1 sibling, 1 reply; 11+ messages in thread
From: Patrick Doyle @ 2007-10-11 13:24 UTC (permalink / raw
  To: Eivind LM; +Cc: git

If you look through the Subversion FAQ or the book (I forget where
I've seen it -- but I know I've seen it), you can export/filter out a
tree from a subversion repository and load it into a new repository.
Then you can import from that new repository.

This presumes you have direct access to the subversion repository and
can run commands like svnadmin --dump.

--wpd


On 10/11/07, Eivind LM <eivliste@online.no> wrote:
> Hi,
> I would like to convert a subversion repository to Git. The subversion
> repository used to track development of several projects (only slightly
> related), and I would like to divide the repository into several smaller
> git repositories.
>
> For example, I want to convert one subversion repository which contains
> the folders:
> trunk/projectA
> trunk/projectB
>
> into two git repositories:
> projectA.git
> projectB.git
>
> As far as I have understood, the way to do this is to
> 1) Convert the entire subversion repository to git with git-svn.
> 2) Make two copies of the whole new git-repository (projectA.git and
> projectB.git).
> 3) Use git-rm to remove projectB from projectA.git, and projectA from
> projectB.git.
>
> This works fine, but both git-repositories now carries the history for
> both projects. If possible, I would like to "clean" the history in the
> repositories, so that I don't see history information for projectA when I
> am browsing logs in projectB.git. Has anyone been in the same situation?
> Do you have suggestions on how it can be solved?
>
> Any help will be greatly appreciated.
>
> Thanks,
> Eivind
> -
> 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] 11+ messages in thread

* Re: Split a subversion repo into several git repos
  2007-10-11 12:51 Split a subversion repo into several git repos Eivind LM
  2007-10-11 13:24 ` Patrick Doyle
@ 2007-10-11 13:46 ` Jonathan del Strother
  2007-10-11 14:02   ` Patrick Doyle
  2007-10-11 21:40   ` Sam Vilain
  1 sibling, 2 replies; 11+ messages in thread
From: Jonathan del Strother @ 2007-10-11 13:46 UTC (permalink / raw
  To: Eivind LM; +Cc: git


On 11 Oct 2007, at 13:51, Eivind LM wrote:

> Hi,
> I would like to convert a subversion repository to Git. The  
> subversion repository used to track development of several projects  
> (only slightly related), and I would like to divide the repository  
> into several smaller git repositories.
>
> For example, I want to convert one subversion repository which  
> contains the folders:
> trunk/projectA
> trunk/projectB
>
> into two git repositories:
> projectA.git
> projectB.git

I have a slightly different layout to you -

projectA/trunk
projectA/branches
projectA/tags
projectB/trunk
projectB/branches
projectB/tags
etc

- but I've been creating separate git repos from that with (for  
example) :

git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA
git-svn fetch


Or will git-svn not work with your sort of layout?

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

* Re: Split a subversion repo into several git repos
  2007-10-11 13:46 ` Jonathan del Strother
@ 2007-10-11 14:02   ` Patrick Doyle
  2007-10-11 14:50     ` Karl Hasselström
  2007-10-11 21:40   ` Sam Vilain
  1 sibling, 1 reply; 11+ messages in thread
From: Patrick Doyle @ 2007-10-11 14:02 UTC (permalink / raw
  To: Jonathan del Strother; +Cc: Eivind LM, git

On 10/11/07, Jonathan del Strother <maillist@steelskies.com> wrote:
> I have a slightly different layout to you -
>
> projectA/trunk
> projectA/branches
> projectA/tags
> projectB/trunk
> projectB/branches
> projectB/tags
> etc
>
> - but I've been creating separate git repos from that with (for
> example) :
>
> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA
> git-svn fetch
>
Just be aware that, if you follow this approach, the commit logs
created by git-svn will be rewritten (relative to the original SVN
logs) with the SVN repository revision and ID information.  I believe
you can disable this behavior by passing the --no-metadata option to
"git-svn init", but I haven't tried this yet.

I also believe that this approach will leave your git repository in
such as state as to recognize that there is a remote repository from
which this repository was fetched.  I have no idea what implications
and long term repercussions (if any) this has.  It just dawned on me
as I was rereading the git-svn man page to look for the --no-metdata
option and read that it will "Set the noMetadata option in the
[svn-remote] config".  Most of that is still Greek to me.

--wpd

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

* Re: Split a subversion repo into several git repos
  2007-10-11 14:02   ` Patrick Doyle
@ 2007-10-11 14:50     ` Karl Hasselström
  0 siblings, 0 replies; 11+ messages in thread
From: Karl Hasselström @ 2007-10-11 14:50 UTC (permalink / raw
  To: Patrick Doyle; +Cc: Jonathan del Strother, Eivind LM, git

On 2007-10-11 10:02:21 -0400, Patrick Doyle wrote:

> Just be aware that, if you follow this approach, the commit logs
> created by git-svn will be rewritten (relative to the original SVN
> logs) with the SVN repository revision and ID information. I believe
> you can disable this behavior by passing the --no-metadata option to
> "git-svn init", but I haven't tried this yet.

Just to clarify: this is true for all git-svn use, and has nothing to
do with this particular case.

> I also believe that this approach will leave your git repository in
> such as state as to recognize that there is a remote repository from
> which this repository was fetched. I have no idea what implications
> and long term repercussions (if any) this has. It just dawned on me
> as I was rereading the git-svn man page to look for the --no-metdata
> option and read that it will "Set the noMetadata option in the
> [svn-remote] config". Most of that is still Greek to me.

Apart from the metadata appended to the commit messages (which you can
turn off with --no-metadata), all the extra data saved by git-svn is
purely local. Meaning that you can always get rid of it by cloning the
repository, if you can't think of a cleverer way to do it.

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

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

* Re: Split a subversion repo into several git repos
  2007-10-11 13:46 ` Jonathan del Strother
  2007-10-11 14:02   ` Patrick Doyle
@ 2007-10-11 21:40   ` Sam Vilain
  2007-10-12 14:14     ` Eivind LM
  1 sibling, 1 reply; 11+ messages in thread
From: Sam Vilain @ 2007-10-11 21:40 UTC (permalink / raw
  To: Jonathan del Strother; +Cc: Eivind LM, git

Jonathan del Strother wrote:
>> For example, I want to convert one subversion repository which  
>> contains the folders:
>> trunk/projectA
>> trunk/projectB
>>
>> into two git repositories:
>> projectA.git
>> projectB.git
> 
> I have a slightly different layout to you -
> 
> projectA/trunk
> projectA/branches
> projectA/tags
> projectB/trunk
> projectB/branches
> projectB/tags
> etc
> 
> - but I've been creating separate git repos from that with (for  
> example) :
> 
> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA
> git-svn fetch
> 
> 
> Or will git-svn not work with your sort of layout?

It does work.  Use:

git-svn init -t projectA/tags -b projectA/branches \
   -T trunk/projectA http://svn.host.com/
git fetch

Also you can expect the import results of each branch to be the same
regardless of whether you import all at once using a command like the
above, or import a single path without passing -t / -b / -T to git svn init.

If you have a lot of projects to mine from a single repository, use
svnsync or SVN::Mirror/svk and then import from the local repository
with --use-svm-props.

Sam.

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

* Re: Split a subversion repo into several git repos
  2007-10-11 21:40   ` Sam Vilain
@ 2007-10-12 14:14     ` Eivind LM
  2007-10-12 14:23       ` Jonathan del Strother
  2007-10-12 20:27       ` Sam Vilain
  0 siblings, 2 replies; 11+ messages in thread
From: Eivind LM @ 2007-10-12 14:14 UTC (permalink / raw
  To: Sam Vilain, Jonathan del Strother; +Cc: git

On Thu, 11 Oct 2007 23:40:40 +0200, Sam Vilain <sam@vilain.net> wrote:

> Jonathan del Strother wrote:
>>> For example, I want to convert one subversion repository which
>>> contains the folders:
>>> trunk/projectA
>>> trunk/projectB
>>>
>>> into two git repositories:
>>> projectA.git
>>> projectB.git
>>
>> I have a slightly different layout to you -
>>
>> projectA/trunk
>> projectA/branches
>> projectA/tags
>> projectB/trunk
>> projectB/branches
>> projectB/tags
>> etc
>>
>> - but I've been creating separate git repos from that with (for
>> example) :
>>
>> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA
>> git-svn fetch
>>
>>
>> Or will git-svn not work with your sort of layout?
>
> It does work.  Use:
>
> git-svn init -t projectA/tags -b projectA/branches \
>    -T trunk/projectA http://svn.host.com/
> git fetch

With my paths this translates into

   $ git-svn init -b eivindlm/branches \
                  -t eivindlm/tags \
                  -T eivindlm/trunk/src/probesimulator \
                  file:///svn-repo/
, which prints the happy message:
   Initialized empty Git repository in .git/

The next command is unfortunately not as happy:
   $ git fetch
   fatal: 'origin': unable to chdir or not a git archive
   fatal: The remote end hung up unexpectedly
   Cannot get the repository state from origin

I suppose this is due to my silly svn-repo layout... However, after some  
trial and error it seems like the following command gives me what I want  
(I don't need tags or other branches than main):

   $ git-svn clone file:///svn-repo/ --follow-parent \
                   -T eivindlm/trunk/src/probesimulator

It seems to realize that the probesimulator directory has moved around in  
my tree, and gives me history for files that belongs in this directory  
only (and not history for other directories). So the problem appears to be  
solved for my part, unless you see a reason for why I should not do it in  
this way.

> [...]

Thanks a lot for the help to everyone who replied!

Eivind

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

* Re: Split a subversion repo into several git repos
  2007-10-11 13:24 ` Patrick Doyle
@ 2007-10-12 14:15   ` Eivind LM
  0 siblings, 0 replies; 11+ messages in thread
From: Eivind LM @ 2007-10-12 14:15 UTC (permalink / raw
  To: Patrick Doyle; +Cc: git

Thanks,
I found svndumpfilter in the svn book, and gave it a try. Unfortunately it  
seems to be confused about files that have moved around in the repository,  
I was at least not able to make it dump the entire history for a directory  
that over time has changed name, and that contains files that have moved  
in from other directories.

Eivind

On Thu, 11 Oct 2007 15:24:59 +0200, Patrick Doyle <wpdster@gmail.com>  
wrote:

> If you look through the Subversion FAQ or the book (I forget where
> I've seen it -- but I know I've seen it), you can export/filter out a
> tree from a subversion repository and load it into a new repository.
> Then you can import from that new repository.
>
> This presumes you have direct access to the subversion repository and
> can run commands like svnadmin --dump.
>
> --wpd
>
>
> On 10/11/07, Eivind LM <eivliste@online.no> wrote:
>> Hi,
>> I would like to convert a subversion repository to Git. The subversion
>> repository used to track development of several projects (only slightly
>> related), and I would like to divide the repository into several smaller
>> git repositories.
>>
>> For example, I want to convert one subversion repository which contains
>> the folders:
>> trunk/projectA
>> trunk/projectB
>>
>> into two git repositories:
>> projectA.git
>> projectB.git
>>
>> As far as I have understood, the way to do this is to
>> 1) Convert the entire subversion repository to git with git-svn.
>> 2) Make two copies of the whole new git-repository (projectA.git and
>> projectB.git).
>> 3) Use git-rm to remove projectB from projectA.git, and projectA from
>> projectB.git.
>>
>> This works fine, but both git-repositories now carries the history for
>> both projects. If possible, I would like to "clean" the history in the
>> repositories, so that I don't see history information for projectA when  
>> I
>> am browsing logs in projectB.git. Has anyone been in the same situation?
>> Do you have suggestions on how it can be solved?
>>
>> Any help will be greatly appreciated.
>>
>> Thanks,
>> Eivind
>> -
>> 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] 11+ messages in thread

* Re: Split a subversion repo into several git repos
  2007-10-12 14:14     ` Eivind LM
@ 2007-10-12 14:23       ` Jonathan del Strother
  2007-10-12 14:47         ` Eivind LM
  2007-10-12 20:27       ` Sam Vilain
  1 sibling, 1 reply; 11+ messages in thread
From: Jonathan del Strother @ 2007-10-12 14:23 UTC (permalink / raw
  To: Eivind LM; +Cc: Git Mailing List

On 12 Oct 2007, at 15:14, Eivind LM wrote:

> On Thu, 11 Oct 2007 23:40:40 +0200, Sam Vilain <sam@vilain.net> wrote:
>
>> Jonathan del Strother wrote:
>>>> For example, I want to convert one subversion repository which
>>>> contains the folders:
>>>> trunk/projectA
>>>> trunk/projectB
>>>>
>>>> into two git repositories:
>>>> projectA.git
>>>> projectB.git
>>>
>>> I have a slightly different layout to you -
>>>
>>> projectA/trunk
>>> projectA/branches
>>> projectA/tags
>>> projectB/trunk
>>> projectB/branches
>>> projectB/tags
>>> etc
>>>
>>> - but I've been creating separate git repos from that with (for
>>> example) :
>>>
>>> git-svn init -t tags -b branches -T trunk http://svn.host.com/projectA
>>> git-svn fetch
>>>
>>>
>>> Or will git-svn not work with your sort of layout?
>>
>> It does work.  Use:
>>
>> git-svn init -t projectA/tags -b projectA/branches \
>>   -T trunk/projectA http://svn.host.com/
>> git fetch
>
> With my paths this translates into
>
>  $ git-svn init -b eivindlm/branches \
>                 -t eivindlm/tags \
>                 -T eivindlm/trunk/src/probesimulator \
>                 file:///svn-repo/
> , which prints the happy message:
>  Initialized empty Git repository in .git/
>
> The next command is unfortunately not as happy:
>  $ git fetch
>  fatal: 'origin': unable to chdir or not a git archive
>  fatal: The remote end hung up unexpectedly
>  Cannot get the repository state from origin


I believe you actually wanted "git-svn fetch" here

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

* Re: Split a subversion repo into several git repos
  2007-10-12 14:23       ` Jonathan del Strother
@ 2007-10-12 14:47         ` Eivind LM
  0 siblings, 0 replies; 11+ messages in thread
From: Eivind LM @ 2007-10-12 14:47 UTC (permalink / raw
  To: Jonathan del Strother; +Cc: Git Mailing List

On Fri, 12 Oct 2007 16:23:44 +0200, Jonathan del Strother  
<maillist@steelskies.com> wrote:
[...]
>>
>>  $ git-svn init -b eivindlm/branches \
>>                 -t eivindlm/tags \
>>                 -T eivindlm/trunk/src/probesimulator \
>>                 file:///svn-repo/
>> , which prints the happy message:
>>  Initialized empty Git repository in .git/
>>
>> The next command is unfortunately not as happy:
>>  $ git fetch
>>  fatal: 'origin': unable to chdir or not a git archive
>>  fatal: The remote end hung up unexpectedly
>>  Cannot get the repository state from origin
>
>
> I believe you actually wanted "git-svn fetch" here

You are right, that solved the problem :)

So both methods work now, apparently giving the same result. Is there a  
difference between the fetch- versus the clone-approach? I am doing this  
as a once-and-for-all import, and would like to forget everything about  
the subversion repository afterwards.

Thanks,
Eivind

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

* Re: Split a subversion repo into several git repos
  2007-10-12 14:14     ` Eivind LM
  2007-10-12 14:23       ` Jonathan del Strother
@ 2007-10-12 20:27       ` Sam Vilain
  1 sibling, 0 replies; 11+ messages in thread
From: Sam Vilain @ 2007-10-12 20:27 UTC (permalink / raw
  To: Eivind LM; +Cc: Jonathan del Strother, git

Eivind LM wrote:
>>
>> git-svn init -t projectA/tags -b projectA/branches \
>>    -T trunk/projectA http://svn.host.com/
>> git fetch
>
> With my paths this translates into
>
>   $ git-svn init -b eivindlm/branches \
>                  -t eivindlm/tags \
>                  -T eivindlm/trunk/src/probesimulator \
>                  file:///svn-repo/
> , which prints the happy message:
>   Initialized empty Git repository in .git/
>
> The next command is unfortunately not as happy:
>   $ git fetch
>   fatal: 'origin': unable to chdir or not a git archive
>   fatal: The remote end hung up unexpectedly
>   Cannot get the repository state from origin
>
> I suppose this is due to my silly svn-repo layout... However, after
> some trial and error it seems like the following command gives me what
> I want (I don't need tags or other branches than main):

Whoops, my mistake.  That should have been "git svn fetch".

Sam.

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

end of thread, other threads:[~2007-10-12 20:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-11 12:51 Split a subversion repo into several git repos Eivind LM
2007-10-11 13:24 ` Patrick Doyle
2007-10-12 14:15   ` Eivind LM
2007-10-11 13:46 ` Jonathan del Strother
2007-10-11 14:02   ` Patrick Doyle
2007-10-11 14:50     ` Karl Hasselström
2007-10-11 21:40   ` Sam Vilain
2007-10-12 14:14     ` Eivind LM
2007-10-12 14:23       ` Jonathan del Strother
2007-10-12 14:47         ` Eivind LM
2007-10-12 20:27       ` Sam Vilain

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