ubuntu(linux)下svn使用kdiff3merge主干

本文发布时间: 2019-Mar-22
在linux下面不能使用小乌龟(TortoiseSVN),idea不能使用svn merge主干代码,每次merge代码时启动虚拟机。按下面的方法操作,可以像小乌龟(TortoiseSVN)一样merge代码了:1、安装kdiff3。跨系统且比较流行代码diff工具。sudo apt-get install kdiff32、安装svn工具。1) sudo apt-get install subversion subversion-tools2)降级安装svn(1.7),参考: KUbuntu/Ubuntu 14.04 (降级)安装 svn 1.73、配置脚本。1)下载svndiffwrapper.txt。http://download.csdn.net/detail/love254443233/79419132)复制:sudo cp svndiffwrapper.txt /usr/bin/svndiffwrapper3) 设置可运行权限。sudo chmod a+x /usr/bin/svndiffwrapper4、修改svn配置信息1)打开配置文件:vim ~/.subversion/config2)修改diff工具及merge-tool-cmd工具的配置### Set diff-cmd to the absolute path of your 'diff' program.### This will override the compile-time default, which is to use### Subversion's internal diff implementation.# diff-cmd = diff_program (diff, gdiff, etc.)diff-cmd = svndiffwrapper### Set diff3-cmd to the absolute path of your 'diff3' program.### This will override the compile-time default, which is to use### Subversion's internal diff3 implementation.# diff3-cmd = diff3_program (diff3, gdiff3, etc.)diff3-cmd = svndiffwrapper### Set diff3-has-program-arg to 'yes' if your 'diff3' program### accepts the '--diff-program' option.# diff3-has-program-arg = [yes | no]### Set merge-tool-cmd to the command used to invoke your external### merging tool of choice. Subversion will pass 4 arguments to### the specified command: base theirs mine merged# merge-tool-cmd = merge_commandmerge-tool-cmd =Kdiff3 "$1" "$2" "$3" -o "$4"5、merge主干。1)命令行进入本地分支的工作目录,如/home/xx/work/svn/xx-hotel-image提交分支(以防不测)。svn commit -m "merge trunk"2)copy主干(trunk)url,如 http://svn.xx.xx.com/svn/xx/xx/xx-api/trunk3)merge代码 (最后面的“.”号可省略,因为操作第1)步)。svn merge http://svn.corp.qunar.com/svn/mobile/mobfx/hms-api/trunk .4)运行过程中遇到冲突时会提示:What would you like to do?[M]erge [A]ccept [I]gnore [R]evert [D]efault [H]elp选择(M)erge进入kdiff3界面操作,该界面跟windows下面使用小乌龟(TortoiseSVN)进行merge大致一样。附:1、界面操作方法1)第一栏为分支新建的版本文件。第二栏是分支正在开发的文件。第三栏为trunk的文件。下面一栏是比较后输出的文件(output)。2)output文件可以编辑,当不能满足merge需要时可以人为的修改。2、svn merge其它常用命令1)merge主干到本地分支:svn merge http://svn.xx.xx.com/svn/xx/xx/xx-api/trunk .2)merge出错时使用回退该操作:svn revert — 取消所有的本地编辑。恢复一整个目录的文件,可以使用--depth=infinity选项:Svn revert --depth=infinity .3)提交本地修改到服务器:svn commit -m "merge trunk" 4)遇到如下错误:svn: E155015: 提交失败(细节如下): svn: E155015: 提交终止: “/home/xx/work/svn/xx-hotel-image/versions.mapping” 处于冲突状态解决方法:svn resolved /home/xx/work/svn/xx-hotel-image/versions.mapping


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:10pm
栏目列表