您的位置:首页 > 编程语言

mac 下svn 代码迁移到git

2015-11-07 01:33 429 查看
安装

clone svn

kevinxwdeMacBook-Air:git-project kevin$ git svn clone http://sources.***.net/svn/***/branches/spider-forked --no-metadata myspider
Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module) (@INC contains:


refer:

* http://blog.puhao.me/%E5%90%90%E6%A7%BD/OS-X-Yosemite(10.10)%E4%B8%8B%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8git-svn%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/

update svn

setting

kevinxwdeMacBook-Air:git-project kevin$ sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/SVN  /System/Library/Perl/Extras/5.18/SVN
kevinxwdeMacBook-Air:git-project kevin$ sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN/  /System/Library/Perl/Extras/5.18/auto/SVN


使用 git svn clone 一个svn的工程到本地

kevinxwdeMacBook-Air:git-project kevin$ git svn clone http://sources.comp.net/svn/asc_search_engine/branches/spider-forked myspider --no-metadata --authors-file=author.txt


成功执行会有类似如下输出

W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
Checked Ahrough mkdocs.yml
A   LICENSE
A   .travis.yml
A   setup.py
A   docs/Deployment.md
A   docs/imgs/developer-tools-network-filter.png
A   docs/imgs/inspect_element.png
A   docs/imgs/search-for-request.png
A   docs/imgs/run_one_step.png
A   docs/imgs/request-headers.png
A   docs/imgs/creating_a_project.png
A   docs/imgs/twitch.png
....
Checked out HEAD: http://sources.comp.net/svn/asc_search_engine/branches/spider-forked r4690


注意:如果提示 有用户不再 –authors指定的文件里, git svn clone 是失败的,可以用echo $? 一定是非0, 本地目录是个空目录, 一定要在再添加author.txt

完成后,进入本地工程目录, 可以用git log查看该工程的日志。此时,原有的svn log都 转为了git log.

kevinxwdeMacBook-Air:myspider kevin$ git log
commit 61879afb2af90651e33dc6c7003715fc722a8da6
Author: wei.xiew <wei.xiew@comp.com>
Date:   Fri Nov 6 15:27:23 2015 +0000

Myspider: remove some original docs of 'pyspider',  and an account and ip info in the conf file

commit 32500016d6a088a18117963a52b7361a1112804b
Author: wei.xiew <wei.xiew@comp.com>
Date:   Fri Nov 6 08:52:13 2015 +0000

Myspider: rename storage as data pipe

commit 6c0981fc2afbfdfc21badd46b2433b770a7d2b30
Author: wei.xiew <wei.xiew@comp.com>
Date:   Fri Oct 30 02:21:21 2015 +0000

[fix #6561531][R123207]Myspider: a url seed db with mysql


git remote add 命令该工程与gitlab上的project对接, 随后可用git remote -v 查看源

gitlab 的project在gitlab的页面上创建, 会得到project的地址:git@gitlab.comp.com:cd-op/myspider.git

kevinxwdeMacBook-Air:myspider kevin$ git remote add origin git@gitlab.comp.com:cd-op/myspider.git
kevinxwdeMacBook-Air:myspider kevin$ git remote -v
origin  git@gitlab.comp.com:cd-op/myspider.git (fetch)
origin  git@gitlab.comp.com:cd-op/myspider.git (push)


将工程推进github

kevinxwdeMacBook-Air:myspider kevin$ git push -u origin master
The authenticity of host 'gitlab.alipay-inc.com (100.67.50.13)' can't be established.
RSA key fingerprint is a4:41:80:60:b1:48:ee:b5:57:6b:8a:f5:d8:96:43:06.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.comp.com,100.67.50.13' (RSA) to the list of known hosts.
Counting objects: 358, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (351/351), done.
Writing objects: 100% (358/358), 2.16 MiB | 539.00 KiB/s, done.
Total 358 (delta 141), reused 0 (delta 0)

To git@gitlab.comp.com:cd-op/myspider.git
* [new branch]      master -> master
Branch master set up to track remote branch master from origin.


完成迁移,可以在gitlab project 上看到所有代码
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: