svn報錯,衝突

C:\workspace\test>svn upConflict 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
如果你輸入s選項,則會列出所有svn解決衝突的選項,如下所示:

(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


【選擇處理方式一:df】

If you type ‘df’ it will show you a all the conflicts in the following format
選擇選項df,則會按如下格式顯示所有衝突

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:
你可以解決衝突通過改變文件內容,例如vim test.txt

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.
保存更改,又出現剛纔的選項。此時你使用r選項,則會合並文件。如下所示:

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.
檢查svn狀態,你會發現文件test.txt前面已變成M

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.


【選擇處理方式二:p】

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.
有時,衝突會複雜一些,可能需要藉助其他工具才能解決,這時你可以使用選項p

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.
文件test.txt包含了用戶1和用戶2的更改。
發佈了50 篇原創文章 · 獲贊 8 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章