喜糖

移动开发工程师 。涉及 android、ios、jni

导航

svn合并

Posted on 2014-03-13 00:36  喜糖  阅读(1503)  评论(0编辑  收藏  举报

本文章介紹基本的合併流程, 以Subclipse為例
 
 
在要合併的目錄, 可以由 Team --> 列出Subclipse所有功能


假設bdp是trunk project, bdp2是branch project
 
1.首先將新專案bdp2分支 Trunk > Branch



2.Branch開發到一半, 若要跟Trunk合併, 這時要選擇bdp2(也就是branch的project)按右鍵, 
選Team -> 合併 ->
選擇 Merge a range of revisions


 

 

 

 

 

 
 



3.開發完成後, 要回主線 Trunk < Branch, 這時要選擇bdp(也就是trunk的project)按右鍵, 

選Team -> 合併 ->

選擇 Reintegrate a branch

 
4.選擇要回去的branch的同階目錄(若從WebContent開始合併, 就指到branch的WebContent)

 

 
5.每次合併的結果, 可從 Merge Results Tab查看

 
Ignored File - A file ignored by version control. You can control what resources will be ignored by going to Window → Preferences → Team → Ignored Resources.
Unversioned File - A file not under version control. These are typically new files that you have not committed to the repository yet.
New File - A versioned file that needs to be added to the remote repository. These are typically files you have either renamed, or moved to a different directory.
Deleted File - A deleted folder. These are folders that you have deleted locally without yet committing the changes to the repository. Note that files are usually removed from the view when they're deleted locally, so they are normally not seen with this icon.
Synchronized File - A file with no local changes.
Local Changes - A file with local, uncommitted changes.
Locked File - A locked file.
Needs Lock - A file that needs a lock to be edited. These are typically files that cannot easily be merged (i.e. binary files), but may have many editors. A file needs a lock when its svn:needs-lock property is set, and Subversion will attempt to make these files read-only in the file system to enforce proper lock negotation.
Conflicted File - A conflicted file. These are typically files that had a commit/update conflict that you marked to resolve later.
Tree Conflicted File - A file that has a tree conflict. These are typically files that have local changes, but have since been moved, removed, or renamed in the repository since the last local copy update.
External File - A file that is external to the project. Linked external files cannot be committed to the repository.
Switched File - A file that has been switched. These are files which belongs to a different working copy than their local parent directory.
In a synchronization view (e.g. via Synchronize with Repository or Commit), as previously described, there are icons which indicate which direction a change is occurring in as well as additional information about that change. These are described below:
Outgoing
Commit Changes - A file whose contents have been modified and will be committed to the repository.
Commit Addition - A file that will be newly added to the repository. This may coincide with a file removal in cases where a file is moved or renamed..
Commit Removal - A file that will be removed from the repository. This may coincide with a file addition in cases where a file is moved or renamed.
Property Change - A file with property changes, in the Commit dialog. On the Synchronize tab, property changes are currently reflected as a normal file modification (Commit Changes).
 
在上次commit後, 部份屬性有變動
由合併的目錄, 會記錄合併後相關訊息(svn:mergeinfo)
以trunk合併branch情境來看
假設 trunk/WebContent merge branch/WebContent
原本上次合併是由 100 ~ 120, 目前最新版本是121, 合併後也會記錄一個版本, 所以會變成122, 那麼mergeinfo這檔案就是記錄100 ~ 122版本, 但重點是我們還沒有commit
所以此訊息會提示, 我們上次commit是100 ~ 120, 合併後版本變成 100 ~ 122, 它希望我們能commit這版本
為了要記錄這次合併的版本, 所做的提示(因為我們可能在下一階又commit其他變動)
Incoming
Remote Changes - A file that has content changes committed to the repository that will be applied to the local copy.
Pull Addition - A new file that will be added to the local copy from the repository. Like the outgoing file addition, this may be the result of a move or rename.
Pull Removal - A file that will be removed from the local copy because it has been removed from the repository. Like the outgoing file removal, this may be the result of a move or rename.
Conflict
Conflicting Versions - A file that has been changed in both the local copy and repository independently, causing a need for conflict resolution. Fixing this condition involves opening up the conflict view or forcibly overwriting changes locally or remotely.
Synchronization Tree Conflict - A file that has a tree conflict. This can occur when there are new changes to a file on one end (either local or remote), and the file is moved, removed, or renamed on the other.
Finally, the Synchronize with Repository option opens the Synchronize tab (Synchronize Tab) with the following buttons:
Synchronize Source - Synchronizes the local copy with the currently selected repository when clicked. Selecting from the drop-down allows switching between different remote code bases.
Show Incoming - Shows only incoming changes (remote → local).
Show Outgoing - Shows only outgoing changes (local → remote).
Show Incoming and Outgoing - Shows both incoming and outgoing changes (remote ↔ local).
Show Conflicts - Shows conflicting changes.
Update Incoming - Updates all local resources with incoming changes after prompt.
Commit Outgoing - Brings up the commit dialog to commit all outgoing changes.
Show Changesets - Breaks up the change lists by revisions.
 
--

Conflict
Delete:只要是目錄有變動, 都算是
Add:
Edit:
Local:本機修改
Incoming:是别人修改, 你要Update或Merge進来

Tree Conflict

update情況

Local delete, incoming edit upon update
Local edit, incoming delete upon update
Local delete, incoming delete upon update (二邊都刪掉, 直接標記解決就行)

merge情況
Local missing, incoming edit upon merge
Local edit, incoming delete upon merge (當trunk合併branch, 若trunk修改此檔案, 但trunk刪除時)
Local add, incoming add upon merge (當branch回trunk, 若truck已有此檔案, 但trunk也新增)

 
測試:
Local delete, incoming edit upon update


 
 
 

 
 
 
最好是每次合併後, 都檢查一下是否有 Tree Conflict, 因為不是每次都有提示