Cloning SVN to BitBucket, branches are not created in git

I've been following the [steps from Atlassian](https://www.atlassian.com/git/migration#!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.

4 answers

1 accepted

0 votes
Answer 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:

http://blogs.atlassian.com/2012/01/moving-confluence-from-subversion-to-git/

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.

Charles

0 votes

I am facing the same issue ... seems jar ~/svn-migration-scripts.jar clean-git --force is deleting branches and Tags

0 votes
Yannick Biet I'm New Here Friday

Same for me in March 2019. I have try on multiple repos. I can see remote branches in git after migration.

 

Trying to use clean-git is telling me that it will create local branches but as soon as i use --force option, the output is slightly different and adds :

# Checking for obsolete branches...
Deleting Git branch 'origin/tags/1.3.0.145' not in Subversion.
Deleted branch origin/tags/1.3.0.145 (was dea7a49).
Deleting Git branch 'origin/tags/1.1.0.102' not in Subversion.
Deleted branch origin/tags/1.1.0.102 (was 40eaa42).
Deleting Git branch 'origin/del-nuget-exe' not in Subversion.
Deleted branch origin/del-nuget-exe (was aca2d46).
Deleting Git branch 'origin/feat-si-atelier-proxy' not in Subversion.
Deleted branch origin/feat-si-atelier-proxy (was 947919d).
Deleting Git branch 'origin/tags/1.1.4.115' not in Subversion.
Deleted branch origin/tags/1.1.4.115 (was 8f2b462).
Deleting Git branch 'origin/tags/1.1.1.105' not in Subversion.
Deleted branch origin/tags/1.1.1.105 (was 2783e61).
Deleting Git branch 'origin/fix-tracking-gpao' not in Subversion.
Deleted branch origin/fix-tracking-gpao (was 14f7d82).
Deleting Git branch 'origin/trunk' not in Subversion.
Deleted branch origin/trunk (was 6bdfbe1).
Deleting Git branch 'origin/tags/1.1.2.107' not in Subversion.
Deleted branch origin/tags/1.1.2.107 (was 31aac71).
Deleting Git branch 'origin/tags/1.2.0.120' not in Subversion.
Deleted branch origin/tags/1.2.0.120 (was 4f830ce).
Deleting Git branch 'origin/tags/1.1.3.111' not in Subversion.
Deleted branch origin/tags/1.1.3.111 (was a7bcf32).
Deleting Git branch 'origin/tags/1.1.0.103' not in Subversion.
Deleted branch origin/tags/1.1.0.103 (was ca7179b).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

274 views 0 12
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