美文网首页
SVN迁移到GIT

SVN迁移到GIT

作者: 小城大麦 | 来源:发表于2017-04-10 11:02 被阅读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/

    相关文章

      网友评论

          本文标题:SVN迁移到GIT

          本文链接:https://www.haomeiwen.com/subject/cmksattx.html