This tutorial is walkthough on how to resolve a conflict in svn (subversion)
First I will make a test.txt
test
Now I will commit the changes
C:\workspace\test>svn ci -m "making a starting point" Sending . Sending test.txt Transmitting file data . Committed revision 2.
Suppose we have 2 users. User1 and User2. Both of them will get and update from svn
C:\workspace\test>svn up A test.txt At revision 2.
Now User1 will change the file to:
User1 is making a conflict test
He then commits his changes
C:\workspace\test>svn ci -m "User1 starting a conflict" Sending . Sending test.txt Transmitting file data . Committed revision 3.
User2 now comes along and changes his local copy of the file not knowing that it has already been updated by User1 on the server.
test User2 making a conflict
When he tries to commit he will get and error from svn.
svn: Commit failed (details follow): svn: File or directory 'test.txt' is out of date; try updating svn: resource out of date; try updating
So User2 performs an update
C:\workspace\test>svn up Conflict discovered in 'test.txt'. Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options:
svn detects that theres a conflict here and require you to take some kind of action.
If you type ‘s’ here you will get a list of the commands and meaning
(e) edit - change merged file in an editor (df) diff-full - show all changes made to merged file (r) resolved - accept merged version of file (dc) display-conflict - show all conflicts (ignoring merged version) (mc) mine-conflict - accept my version for all conflicts (same) (tc) theirs-conflict - accept their version for all conflicts (same) (mf) mine-full - accept my version of entire file (even non-conflicts) (tf) theirs-full - accept their version of entire file (same) (p) postpone - mark the conflict to be resolved later (l) launch - launch external tool to resolve conflict (s) show all - show this list
If you type ‘df’ it will show you a all the conflicts in the following format
Select: (p) postpone, (df) diff-full, (e) edit, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: df --- .svn/text-base/test.txt.svn-base Tue Aug 10 10:59:38 2010 +++ .svn/tmp/test.txt.2.tmp Tue Aug 10 11:33:24 2010 @@ -1 +1,3 @@ -test \ No newline at end of file +<<<<<<< .mine +test User2 making conflict======= +User1 is making a conflict test>>>>>>> .r3
‘e’ option will open the conflicted file in the text editor that you configured for svn to use. In this case it will show
<<<<<<< .mine test User2 making conflict======= User1 is making a conflict test>>>>>>> .r3
You can resolve the conflict here by changing the text to what you desire.
For example:
User1 is making a conflict test User2 making conflict
save your changes and exit your text editor and it will give you the conflict options again. Now if you use the ‘r’ it will mark the file is merged with a ‘G’. A status of ‘G’ means there was a conflict and it has been resolved.
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: e Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: r G test.txt Updated to revision 3.
you can now check the status with svn status. You see that test.txt is marked as ‘M’ all thats left to do is commit.
C:\workspace\test2>svn st M test.txt C:\workspace\test2>svn ci -m "conflict resolved" Sending test.txt Transmitting file data . Committed revision 4.
Sometimes the conflicts are a bit more extensive and it requires more time or better tools to resolve the conflict in these cases you can chose ‘p’ to postpone the resolution.
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved, (mc) mine-conflict, (tc) theirs-conflict, (s) show all options: p C test.txt Updated to revision 3. Summary of conflicts: Text conflicts: 1
Now if you look in your directory you will see that svn has created a few extra files for you.
08/10/2010 11:44 AM 94 test.txt 08/10/2010 11:44 AM 26 test.txt.mine 08/10/2010 11:44 AM 27 test.txt.r2 08/10/2010 11:44 AM 31 test.txt.r3
The test.txt file is now a file with both User2 and User1′s changes but marked.
<<<<<<< .mine test User2 making conflict======= User1 am making a conflict test>>>>>>> .r3
test.txt.mine is User2′s copy.
test User2 making conflict
test.txt.r2 is the original base copy
test
test.txt.r3 is the copy User1 commited
User1 is making a conflict test
At this point you can choose your favorite merge tools to merge the differences in a file.
I suggest merging the differences into test.txt and the do a
C:\workspace\test>svn resolve --accept working test.txt Resolved conflicted state of 'test.txt'
You can also use any of the other files if you wanted to and just pass resolve –accept a different argument. Here are the valid arguments
base Choose the file that was the BASE revision before you updated your working copy. That is, the file that you checked out before you made your latest edits. working Assuming that you've manually handled the conflict resolution, choose the version of the file as it currently stands in your working copy. mine-full Resolve all conflicted files with copies of the files as they stood immediately before you ran svn update. theirs-full Resolve all conflicted files with copies of the files that were fetched from the server when you ran svn update.
Now you are ready to commit.
C:\workspace\test>svn ci -m "conflict resolved" Sending test.txt Transmitting file data . Committed revision 4.
相关推荐
Xcode 4 快速入门教程:[1] Xcode 4 Project Setup 视频
iOS boost asio demo
svn+xcode配置, 配置后,方便代码的提交与更新。
mac 系统下如何使用svn进行版本管理。
Explore the major features of Xcode: project management, building UIs with storyboards, code editing, compiling apps, fixing bugs and performance problems, unit- and UI testing, and source code ...
xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH-附件资源
最近接触SVN,由于有macOS 所以收集了点在mac下使用SVN的方法,跟大家分享下,希望能帮倒跟我一样是新手的朋友。
Xcode的迷人多彩主题 :rainbow: . 。 代码编辑主题也不例外。 但我总是发现大多数黑暗主题使用的颜色非常丑陋——陈旧、浑浊、冲突,最终无法利用它们更阴暗的环境。 所以Charmed Dark背后的想法是创建一个明亮、...
配置Xcode版本控制SVN详细步骤.内容比较清楚
xcode-one-dark:Xcode的Atom One Dark主题
Beginning Xcode: Swift 3 Edition [Apress, 2016] ISBN-10: 1430250046 | 463 pages | PDF | 26 MB 代码下载:https://github.com/apress/beg-xcode-swift-3-ed This book will not only get you up and running ...
xcode-monokai-revisited:Monokai重新访问的Xcode主题
Xcode缺失资源libstdc++文件
Title: Xcode 6 Start to Finish: iOS and OS X Development, 2nd Edition Author: Fritz Anderson Length: 656 pages Edition: 2 Language: English Publisher: Addison-Wesley Professional Publication Date: ...
Xcode服务器机器人 :robot: 和持续集成指南目标-Xcode使用Xcode Server或XCS构建的一个按钮对于使用Xcode构建的应用程序,您是否具有CI或持续集成? 有很多选择,它们都有自己的优势。 但是考虑一下直接内置在Xcode...
Xcode垃圾清除器这是一个简单的脚本,用于删除正在开发中的Xcode的垃圾文件。 如果你需要一个完全成熟的应用程序,检查出。安装 $ gem install xcode_trash_remover用法 $ xcclean Usage: xcclean [options] --check...
XOCDE下安装SVN,修改host:在应⽤用程序⾥里⾯面打开终端(terminal),输⼊入 sudo vi /etc/hosts...
进入/应用程序/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ ,然后将解压后的文件夹直接添加进去,重启Xcode即可。
Xcode开发环境 Xcode开发环境Xcode开发环境