SVN迁移到GIT
2017-04-10 本文已影响21人
小城大麦
生成svn用户
svn log ^/ --xml | grep "^<author" | sort -u |perl -pe 's/<author>(.*?)<\/author>/$1 = /' > users.txt
转换为git用户
svn2git.py
c = open('users.txt').readlines()
f = open('git_users.txt','w')
for l in c:
l = l.replace('\n','')
name = l.split(' =')[0]
gname = name.split('.')
firstname = gname[0].capitalize()
fullname = firstname
if len(gname) == 2:
fullname = firstname + ' ' + gname[1].capitalize()
l = '%s = %s <%s@youcompay.com>\n'%(name,fullname,name)
f.write(l)
f.close()
checkout svn的数据:
git svn clone http://your_svn_url --authors-file git_users.txt --no-metadata -s myproject
如果你的svn结构是标准结构,比如http://root/mobile/trunk,http://root/mobile/branches,http://root/tags
那么your_svn_url=http://root/mobile/