简体   繁体   中英

git svn clone, mergeinfo are lost

We have a SVN setup which branch merge happens quite often. And I am currently trailing migrate to git. I am using svn2git for the migration, but I think the same does apply to git svn.

It seems that svn git clone will not retain mergeinfo from svn, as the result of svn and git merge working differently? For example, after dong git svn clone to migrate a svn trunk repositoy (with or without the feature branch). doing git log --full-history will only show the commit in the trunk where the branch been merged into, but all the commit history inside the branch which this merge introduced into trunk are not there anymore, but it does shows in svn repo if using TortoiseSVN and enable the 'Include merged reversions'. It seems that all the mergeinfo inside svn are not retained/copied into git master/trunk repository? Is it what supposed to happened?

I've read thatthat SubGit can handle that(I haven't tried it yet). But just want to make sure that git svn clone indeed not retain the mergeinfo propertiy/information from svn repository in git.

As @Vampire and others suggested from other places and SO Q & As: git svn probably not the best tool to import/convert svn repos, I am pretty sure it will works for certain cases. But fails mystery (to me anyway) in edge cases.

In our cases, it was because out non-standard repo structure, it has a shared root level trunk and branches for lots of different applications. So its structure looks like 'trunk\\app1, app2, app3 ...', and 'branches\\app1_feature1, app1_feature2, app2_feature, app3_feature1'.

Initially I didn't import any branches, which didn't bring the merged info from branch into trunk. I then tried to move the trunk and branch I need into different location in the same svn repo as standard structure, but git svn doesn't seems happy with that either. After that I tried SubGit as it seems easy enough to getting started and is free for importing, but have no success initially as it's using the same moved trunk/branch. I then tried to use SubGit to import the whole 'branches' and finally got some of the merged infor back, but still missing some earlier revision info due to renamed/moved trunk.

At last I end up using ruby gem 'svn2git' with the following comment:

svn2git https://svn-host/product --trunk trunk/application1 --branches branches 
   --no-minimize-url --notags --metadata --authors ../../authors.txt -v 

which as least brings the most recent merged info back and as a quick look, seems has all the revisions from trunk even with the renamed/moved old branch because the new trunk. But the conversion took really really long time, and I have to leave it running overnight, and it brings all the unnecessary branches from other applications into my git clone.

Note : For the comment I am using for svn2git, I later realized that the '--branches' parameter can be leaved out as 'branches' is the default value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM