I have an SVN
-repository which I would like to convert into a git
-repository. I'm using svn2git
to achieve this. Unfortunately it seems like the tool is having problems getting the tags right. My SVN
-repository looks like this:
.../branches
.../tags
project-version-5.2.5/
project-version-5.3.0/
project-version-5.3.1/
project-version-5.4.0/
project-version-5.5.0/
project-version-5.5.1/
project-version-5.5.2/
project-version-5.5.3/
project-version-5.5.4/
project-version-5.6.0/
project-version-5.6.1/
project-version-5.6.2/
project-version-5.6.3/
project-version-5.6.4/
project-version-5.6.5/
project-version-5.6.6/
project-version-6.0.0/
project-version-6.0.1/
project-version-6.0.2/
project-version-6.1.0/
project-version-6.1.1/
project-version-6.1.2/
project-version-6.2.0/
project-version-6.2.1/
.../trunk
But the git repository is not representing this. The tags look like this:
bash:~$ git tag
project-version-5.2.5
project-version-5.3.0
project-version-5.3.1
project-version-5.3.1@3812 <-- I have no idea, where that is coming from...
project-version-5.4.0
project-version-5.5.0
project-version-5.5.1
project-version-5.5.2
project-version-5.5.3
project-version-5.5.4
project-version-5.6.0
project-version-5.6.1
project-version-5.6.2
project-version-5.6.3
project-version-5.6.4
project-version-5.6.5
Notice the missing tags. They are for some reason stored as remote branches:
bash:~$ git branch -r
svn/tags/project-version-5.6.5@4990 <-- Yay, random numbers!
svn/tags/project-version-5.6.6
svn/tags/project-version-5.6.6@5620 <-- And another one.
svn/tags/project-version-6.0.0
svn/tags/project-version-6.0.1
svn/tags/project-version-6.0.2
svn/tags/project-version-6.1.0
svn/tags/project-version-6.1.1
svn/tags/project-version-6.1.2
svn/tags/project-version-6.2.0
svn/tags/project-version-6.2.1
svn/trunk
What is happening here?
Edit: I forgot to add my command: svn2git http://path/to/repository --no-minimize-url --verbose --username='username' --trunk trunk --nobranches --tags tags
Edit2: I just checked and found, that the seemingly random numbers are actually revisions in the SVN
-repository, which the tags were made from. It's kind of strange, that only 3 out of ~20 tags get the revision added to them...
Edit3: Obviously the problem has something to do with the comment of one tag, which contains "
. All tags after that one are saved as branches, because svn2git
doesn't escape "
and tries to do something like
git tag -a -m "blablabla "blablabla"." "project-version-5.6.5@4990" "svn/tags/project-version-5.6.5@4990"
which fails for obvious reasons. I still have no idea, why for some tags it adds the revision number though. If anyone has any suggestions how to overcome this problem, I would be very thankful.
Edit4: I found the solution for the escaping problem. The escape-function in the svn2git
-source is just kind of weird...It only substitutes single quotes ('
) with '\''
. I'm done...
I fixed the problem by adding double-quote escaping. Since this change is already suggested on github
I didn't start another pull-request for that. Though for the next one with the same problem, here is what I did:
locate migration.rb
- In my case this was in /var/lib/gems/1.9.1/gems/svn2git-2.2.2/lib/svn2git/migration.rb
escape_quotes()
(currently to be found in lines 335-337
).gsub("\"", "\\\"")
to the bodyI hope, this will help someone with the same problem some time :)