SVN Mirror missing commits due to structure change in SVN

Hello there,

I'm importing, with SVN Mirror, an SVN repository that has the usual structure:

  • project
    • trunk
    • branches
    • tags

The import works as flowless as always, except a lot of commits are missing.

After a short investigation, I found the cause: The structure in SVN hasn't been always like that. The trunk used to coincide with the project's main folder:

  • project (trunk)
    • branches
    • tags

So my import into git misses all the commits belonging to the old structure.

The switch in the SVN repository was made with svn move. The history in SVN itself looks fine. But the import into git seems to look at the new project/trunk structure only.

Does anywone know how I could get a git repository with the old and new SVN structure merged into a linear master? Ideally without changing anything on the SVN repository.

My idea was to import "project" as the master, "project/trunk" as a branch, and then, in git, rebase project/trunk on top of the master. But I can't seem to figure out the correct mapping subgit layout.

I tried with

trunk = .:refs/heads/master

but "." doesn't seem to be accepted as a valid folder.

Any idea?

4 answers

1 accepted

Hello Roberto,

Unfortunately it is impossible to import both ^/project and ^/project/trunk into separate branches; our plugin can only import ^/project as a branch but then ^/project/trunk is a regular directory within this branch or the plugin can import ^/project/trunk and then the history of ^/project get skipped.

As I workaround I'd recommend you to run two separate imports:

  1. For importing ^/project specify the following settings on Subversion Mirror page:

    Subversion URL = <SVN_ROOT>
    Trunk = project:refs/heads/master
    Branches = branches/*:refs/heads/*
    Tags = tags/*:refs/tags/*
  2. Use the following setting for importing ^/project/trunk:

    Subversion URL = <SVN_ROOT>/project
    Trunk = trunk:refs/heads/master
    Branches = branches/*:refs/heads/*
    Tags = tags/*:refs/tags/*

Once you have two separate Git repositories imported from SVN, you can join their histories using grafts/replace + `git filter-branch` technique. Basically, you should edit master branch as follows: set last commit of ^/project history as a parent to the very first commit of ^/project/trunk history. For more information on that please refer to this blogpost (see Fixing up history part) and at Git docs.

Regards,

Semyon

Thanks Semyon,

That sounds sensible. I'm giving it a try. I'm not familiar with the techniques for editing the git branch afterwards, but I'll try.

Roberto

I have tried the import as above. One problem is that import number one takes forever and eventually fills up my disk space. I guess that's because it's looking at all projects under <SVN_ROOT>.

I would be very interested to dig into this problem and build some useful expertise. But I'm afraid commercial reasons will have priority here: in this case the cost of solving this problem is higher than losing all the history. So I will just import the files into an empty git repository, starting history from scratch.

Thank you anyway for your useful answer!

I have tried the import as above. One problem is that import number one takes forever and eventually fills up my disk space. I guess that's because it's looking at all projects under <SVN_ROOT>.

Indeed, I somehow missed that part: when importing ^/project, it should take significant amount of time to process those revisions committed to ^/project/trunk and ^/project/branches. So, there's one more step here: you should find that revision when ^/project was moved to ^/project/trunk and perform initial import of ^/project until that revision only. You can achieve that by stopping import progress (there's a 'pause' button on Subversion Mirror page).

I would be very interested to dig into this problem and build some useful expertise. But I'm afraid commercial reasons will have priority here: in this case the cost of solving this problem is higher than losing all the history. So I will just import the files into an empty git repository, starting history from scratch.

Ok. In any case feel free to conact us at support@subgit.com, if you'd still have any questions. Please also consider importing at least that part of SVN history after moving ^/project to ^/project/trunk (AFAIU you've already done that), quite often it is very helpful to have more or less recent history imported.

Regards,

Semyon

Are there any plans to create this feature?

We failed to do this manually. We tried multiple tries and took use hours, but still the history is broken or gone.

 

If we rename  <SVN_ROOT>/test to  <SVN_ROOT>test2. The commits on  <SVN_ROOT>/test are missing. We thing that this case isn't difficult to support?

 

It is fine to use if this is a paid plugin.

Hello Julian,

Could you please provide more details on the problem:

  • How branches and tags were organized before and after the move?
  • What branches and tags mappings were you using to import the history?

Do I understand your case correctly saying that you had the following structure:

SVN_ROOT/test/trunk
SVN_ROOT/test/branches/*
SVN_ROOT/test/tags/*

that was later moved to

SVN_ROOT/test2/trunk
SVN_ROOT/test2/branches/*
SVN_ROOT/test2/tags/*

Please send your comments to support@subgit.com so we can proceed there.

Thanks,
Semyon 

 

Thanks for the fast response.

I will send an email

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

172 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you