Luca Putzu
Luca Putzu

Reputation: 1456

git-svn clone within a specific revision range

I'm trying to use git-svn to import a brunch of projects hosted in a svn server.

The repository structure looks as follows

root
    [...]
    project 1
        trunk
        branches
        tags
    project 2
        trunk
        branches
        tags
    [...]

what I want to achieve is to import all the svn history of project1 and project2.

Unfortunately the origin repository contains more than 2 million revisions... a full git-svn clone would last forever.

So I retrieved the first and last revision of my two projects and tried to run

git svn clone -s https://svn.bansel.it/h2o/ \
    --include-paths='^[/](Project1|Project2)' \
    -r1788813:1792593

where 1788813 is the first revision and 1792593 is the last i'm intrested in.

When I exexute the command it runs withot error. I also notice some network traffic, but if later on i try a to run git svn log

$ git svn log
fatal: bad revision 'HEAD'
rev-list --first-parent --pretty=medium HEAD --: command returned error: 128

also the target repository seems completely empty. Am I missing something?

EDIT

I will not be able to shut down the SVN repository after the import, so i will need a bidirectional synchronization

Upvotes: 2

Views: 6198

Answers (1)

Vampire
Vampire

Reputation: 38669

Your clone command is wrong.

-s with URL https://svn.bansel.it/h2o/ tells git-svn to look at https://svn.bansel.it/h2o/trunk, https://svn.bansel.it/h2o/tags and https://svn.bansel.it/h2o/branches. There it does not find anything and thus your clone does not contain any commits and thus no HEAD reference.

It might be a good idea to have two git repositories, one for each of your projects, so two clone commands like git svn clone -s https://svn.bansel.it/h2o/Project1/ -r1788813:1792593 and git svn clone -s https://svn.bansel.it/h2o/Project2/ -r1788813:1792593.

Or if you want both in the same repository within different remotes you can do the clone commands with the same git repository as target, using --prefix=origin-project1 and --prefix=origin-project2 to get the two projects in two separate remotes. But I really think you should use separate Git repos for those two.

Note: Be aware that you also need the revision argument for each subsequent fetch as far as I remember, but I might be wrong, I usually don't constrain the revisions for git-svn.

Upvotes: 3

Related Questions