Cloning SVN to BitBucket, branches are not created in git

I've been following the [steps from Atlassian](!migration-convert) for converting my SVN repositories to Git and then pushing them to BitBucket. Overall the process has been realtively painless. I've already moved loads of SVN to BitBucket, but up to this point the migration has dealt with realtively small and little used projects.

Now I'm trying to convert a more heavily used project, with lots of tags and some active svn branches. None of these repositories use a --stdlayout, so I am defining my layout manuallly. I've tried a few different things, and no matter what I do, `git branch` only every shows me the master branch. None of the other branches are being created.

Most recently, I tried this:

git svn clone --trunk="/MyProject/trunk/MyProjectMobileApp" --branches="/MyProject/branches/ProblemChild --branches="/MyProject/branches/ios7Work" --tags="/MyProject/tags/MobileApp" --tags="/MyProject/tags/released/MobileApp" --authors-file=authors.txt https://user@svn.fq.dn/svn/iOS MyProject

When that finished (almost 24 hours later), I ran

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git

The output indicated that it was going to delete branches from git that did not exist in Subversion:

# Checking for obsolete branches...
svn: warning: W160013: URL 'https://user@svn.fq.dn/svn/iOS/MyProject/branches/ios7Work' non-existent in revision 4448
svn: E200009: Could not list all targets because some targets don't exist
Deleting Git branch 'ios7work' not in Subversion.
Deleted branch ios7work (was f4ee5b6).
Deleting Git branch 'origin/master' not in Subversion.
Deleted branch origin/master (was 241bd27).
Deleting Git branch 'problemchild' not in Subversion.
Deleted branch problemchild (was 0a781d8).

Frustrating. The Problem child branch has been reintegrated back into trunk (in SVN), but it has not been deleted. So it does technically exist in SVN HEAD, but it is effectively dead. We have left it in place because we wanted to review a couple of things in it. The bigger problem in the ios7Work branch. It is alive. It has not been reintegrated, and also exists in SVN HEAD. The thing that is throwing me off is the warning on line 2 of the output above. My HEAD right now is r4447.

I found some documentation that indicated that something may be amiss with my config. So I ran the following:

git config --add svn-remote.ios7work.url https://user@svn.fq.dn/svn/iOS/MyProject/branches/ios7Work
git config --add svn-remote.ios7work.fetch :refs/remotes/ios7work
git svn fetch ios7work

It complained, so I google around a bit, and edited the .git/config to make the ios7work stuff look like this:

[svn-remote "ios7work"]
    url = https://user@svn.fq.dn/svn/iOS
    path = /MyProject/branches/ios7Work
    fetch = :refs/remotes/ios7work

This time the `git svn fetch ios7work` apeared to fetch a bunch of stuff, but when I ran the `clean-git` command from above I got the same output. I have run `clean-git --force`. No matter what I try, the branches are being dropped in git.

Any advice will be greatly appreciated. I've been struggling with this for the better part of 4 days now.

2 answers

1 accepted

What I ended up doing is migrating folder by folder (each folder was going to be it's own repo anyhow). I left this folder for last, and tweaked it to make the layout more standard. I ended up getting it to work.

I kind of blindly accepted the "Atlassian way" in that article, and in hindsight, I wish I had done a bit more research about it.

Anyhow, all's well that ends well.

Hi Kirk,

I'm sorry to hear that.

Honestly, given how little work the clean-git command actually does I would just skip that step. It's basically an implementation of some of the scripts in the following blog post:

Depending on which parts of the cleanup you need feel free to run them manually. The only one you really need is to convert the SVN remote branches into normal Git branches (see "Create the final branches").

Let me know how you go.


Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

705 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot