<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Dict.CN 在線詞典, 英語學習, 在線翻譯

    都市淘沙者

    荔枝FM Everyone can be host

    統計

    留言簿(23)

    積分與排名

    優秀學習網站

    友情連接

    閱讀排行榜

    評論排行榜

    TortoiseSVN 日常操作指南

    原文http://blog.csdn.net/happy4nothing/archive/2005/05/19/376604.aspx
    TortoiseSVN

    A Subversion client for Windows

    Stefan Küng

    Lübbe Onken

    Simon Large

    2005/01/17 19:09:21

    二〇〇五年四月 Daan譯


    Table of Contents

    Chapter?4.? 日常操作指南... 4

    4.1.?使用 TortoiseSVN.. 4

    4.2.?認證... 5

    4.3.?導入數據到倉庫Importing Data Into A Repository. 5

    4.3.1.?倉庫規劃Repository Layout 5

    4.3.2. 導入Import 7

    4.3.3. 特殊文件Special Files. 8

    4.3.4. 參考項目Referenced Projects. 9

    4.4.?取出工作副本Checking Out A Working Copy. 9

    4.5.?獲取狀態信息Getting Status Information. 10

    4.5.1.?覆蓋圖標Icon Overlays. 10

    4.5.2.?資源管理器中TortoiseSVN的專欄... 12

    4.5.3.?倉庫狀態Status Of The Repository. 12

    4.5.4. 查看區別Viewing Diffs. 13

    4.6. 更新工作副本Update Your Working Copy With Changes From Others. 13

    4.7. 解決沖突Resolving Conflicts. 16

    4.8. 把你的修改發送到倉庫Sending Your Changes To The Repository. 16

    4.9. 獲取(修改)文件(目錄)信息Get/Set Information About Files/Directories. 19

    4.10. 整合Bug跟蹤系統Integration with Bugtracking Systems. 21

    4.11. 加入新文件和新目錄Adding New Files And Directories. 22

    4.12. 忽略文件和目錄Ignoring Files And Directories. 23

    4.13. 刪除、重命名、移動Deleting, Renaming And Moving. 24

    4.14. 取消改變Undo Changes. 25

    4.15. 修訂日志窗口Revision Log Dialog. 26

    4.15.1. 調用日志窗口Invoking The Log Dialog. 26

    4.15.2. 獲取附加信息Getting Additional Information. 27

    4.15.3. 獲取所有日志Getting all log messages. 29

    4.15.4. 修改日志內容和作者Changing the log message and author 29

    4.15.5. 統計信息Statistical Information. 29

    4.16. 分支/標記Branching / Tagging. 30

    4.16.1. 創建分支或標記Creating a Branch or Tag. 30

    4.16.2. 取出還是切換?To Checkout or to Switch... 31

    4.17. 合并Merging. 32

    4.17.1. Merging a Range of Revisions. 32

    4.17.2. Merging Two Different Trees. 34

    4.18. 創建和應用補丁Creating and Applying Patches. 35

    4.18.1. 創建補丁Creating a Patch File. 35

    4.18.2. 應用補丁Applying a Patch File. 35

    4.19. 副本重定位Relocating a working copy. 36

    4.20. 倉庫瀏覽器The Repository Browser 36

    4.21. TSVN的設置TortoiseSVN's Settings. 37

    4.21.1. 一般設置... 37

    4.21.2. 外觀感受設置... 40

    4.21.3. 網絡設置... 41

    4.21.4. 比較/合并設置... 42

    4.22. 誰動了哪一行?Who Changed Which Line?. 45

    4.23. 版本路線圖Revision Graphs. 46

    4.24. 最后Final Step. 48


    Chapter?4.? 日常操作指南

    Table of Contents

    這份文檔描述TortoiseSVN的日常用法。注意這里不介紹CVS或者Subversion。

    如果你需要一份Subversion的版本控制介紹,我們推薦您閱讀Subversion: The Definitive Guide

    這份文檔像TortoiseSVN和Subversion一樣,也一直在改進之中。如果發現任何錯誤,請在郵件列表中告訴我們,以便我們更新這份文檔。請原諒,下面的一些貼圖可能不是最新軟件版本的貼圖,因為我們都是在工作之余來維護的。

    4.1.?使用 TortoiseSVN

    圖1:在版本控制下的目錄菜單

    所有TortoiseSVN命令都集成在Windows的資源管理器的菜單中。當你在一個文件或文件夾單擊鼠標右鍵時,大多數命令都會直接顯示出來。哪些菜單顯示出來,依賴于文件或文件夾是否處于版本控制之下。

    在工作副本目錄中,當你用鼠標右鍵拖拽文件或文件夾到一個新目錄,或者把沒有在版本控制下的文件或文件夾拖拽到版本控制下的目錄中,就會顯示另外一些命令在右鍵菜單中。

    4.2.?認證

    假如你試圖訪問一個有密碼保護的倉庫,一個認證對話框會跳出來。

    圖2:認證對話框

    輸入你的用戶名和密碼。那個復選框可以讓TortoiseSVN保存認證信息在Subversion的默認目錄中:$APPDATA\Subversion\auth。

    如果你想讓Subversion和TortoiseSVN忘記你的認證信息,你必須刪除相關的文件。

    重要信息:

    在Windows2000及其以上的系統中,認證信息被加密保存在注冊表中。要刪除認證信息,請選擇settings對話框,并且點擊Clear Auth Cache按鈕。

    提示:

    如果你是使用WindowsNT域的認證方式,那么在輸入用戶名時要包括域名,比如:MYDOMAIN/johnd

    4.3.?導入數據到倉庫Importing Data Into A Repository

    4.3.1.?倉庫規劃Repository Layout

    在將數據導入到倉庫之前,你必須先想好如何組織存放你的數據。如果你使用一種我們推薦的規劃方式,你將在以后的使用中感覺到很舒服。

    我們這里有很多種標準的推薦倉庫組織形式。大多數人會創建一個trunk目錄來存放開發的“主線”,一個branches目錄來存放支線副本,另外還有一個tags目錄來存放標簽副本。假如一個倉庫只保存一個項目,經常會創建這樣的幾個頂級目錄:

    /trunk

    /branches

    /tags

    如果一個倉庫存放多個項目,經常會像下面這樣根據分支來規劃:

    /trunk/paint

    /trunk/calc

    /branches/paint

    /branches/calc

    /tags/paint

    /tags/calc

    ...或者根據項目分成多個目錄:

    /paint/trunk

    /paint/branches

    /paint/tags

    /calc/trunk

    /calc/branches

    /calc/tags

    如果多個項目之間的關系不是很緊密,并且他們都是被單獨取出的,那根據項目來規劃會比較有意義些。For related projects where you may want to check out all projects in one go, or where the projects are all tied together in a single distribution package, it is often better to index by branch. This way you have only one trunk to checkout, and the relationships between the sub-projects is more easily visible.對那些相關的項目(),最好根據分支來組織規劃。這樣的話,你就只有一個trunk需要checkout,而且子項目間的關系會更明顯。

    你如果采用/trunk /tags /branches并列于根目錄的方式,那你必須為每個branch和tag復制整個trunk,也就是說這種結構顯得更機動些。

    對不相干的項目來說,你可以使用多個不同的倉庫。當你提交一個改動,版本號會是整個倉庫的版本號,而不是項目的版本號。2個不相干的項目共享一個倉庫會在版本號方面導致極大的不方便。Subversion和TortoiseSVN的項目看起來好像在同一個地址,但事實上他們在完全不同的倉庫中研發著,并且在版本號方面完全的不相干。

    當然,你可以不管上面提到的這些形式。你可以隨意發揮以滿足你或者你的團隊的需要。記住不管你怎么選擇,那都不會是一個永久的形式,你可以在任何時候重新組織你的倉庫。因為branches和tags都是很普通的目錄,只要你愿意,TortoiseSVN可以隨時移動它們,或改名。

    從一種形式轉換到另一種形式僅僅需要在服務器端做一些文件或目錄移動操作;如果你不喜歡你倉庫的某種組織形式,盡管大膽的操作那些目錄。

    到這里,如果你還沒有在你的倉庫中創建一個基本的目錄架構,接下來你應該這么做:

    1.?????? 在你的硬盤中創建一個空目錄。

    2.?????? 在這個目錄中創建一個你中意的目錄組織形式。注意現在不要放任何文件進去。

    3.?????? 接下來把這個結構導入倉庫。在新建的那個目錄上單擊鼠標右鍵,選擇Import…。這樣,就把你剛才創建的臨時目錄導入到倉庫的根目錄了,并創建了倉庫的基本架構。

    注意:你導入的這個目錄的目錄名是不應該出現在倉庫中的,應該只有目錄中的內容會出現。比如,創建下面的目錄結構:

    C:\Temp\New\trunk

    C:\Temp\New\branches

    C:\Temp\New\tags

    C:\Temp\New 導入到倉庫的根目錄,那么根目錄看起來應該是這樣的:

    /trunk

    /branches

    /tags

    另外你也可以使用倉庫瀏覽器(repository browser)直接在倉庫中創建新目錄。

    4.3.2. Import

    在把你的項目導入到倉庫之前,下面的工作必須做好:

    1.?????? 把項目中不需要的文件刪除。(臨時文件、編譯器創建的文件,比如*.obj、2進制文件等。)

    2.?????? 把目錄和子目錄中的所有文件整理一遍。雖然你可以在導入之后再來進行重命名或刪除等操作,但是還是推薦你在導入之前把你的項目整理好。

    現在,在資源管理器(windows explorer)中選擇項目的根目錄,單擊鼠標右鍵,選擇Import…命令,跳出一個對話框:

    在這個對話框中你需要填寫你要將項目導入倉庫的URL地址。

    那個Important Message是用來記錄日志信息的。

    重要信息:

    和exclude pattern匹配的文件或文件夾不會被導入。

    當你按下OK按鈕,TortoiseSVN就開始把整個目錄樹包括所有文件導入到倉庫了。和前面講到的一樣,這個目錄的名字不會出現在倉庫中,只有目錄中的內容會出現。現在,你的這個項目就處于版本控制之下了。請注意,你剛才導入的這個目錄(在你本地硬盤上的這個)并沒有處于版本控制下!要獲取一份處于版本控制之下的工作副本,你需要對剛導入的版本做一次取出(Checkout)操作。

    4.3.3. Special Files

    有時候你需要版本控制一個存儲著用戶個性信息的文件。也就是說這個文件每個開發者或用戶都會去修改以適應他本地的設置。但每個用戶在進行提交(commit)操作時都會把這個文件的修改提交給倉庫,這就使得版本控制這樣一個文件很困難。

    在這種境況下,建議使用模版文件。你可以創建一個包含開發人員需要的所有數據的文件,把它添加到版本控制之下,然后讓開發人員取出這份文件。接下來,每個開發人員就可以給這個文件做個備份,然后給他改個名字。這樣操作之后,不管怎么修改這個備份都不再是什么問題了。

    As an example, you can have a look at TortoiseSVN's build script. It calls a file named TortoiseVars.bat which doesn't exist in the repository. Only the file TortoiseVars.tmpl. TortoiseVars.tmpl is the template file which every developer has to create a copy from and rename that file to TortoiseVars.bat. Inside that file, we added comments so that the users will see which lines they have to edit and change according to their local setup to get it working.

    So as not to disturb the users, we also added the file TortoiseVars.bat to the ignore list of its parent folder, i.e. we've set the Subversion property svn:ignored to include that filename. That way it won't show up as unversioned on every commit.

    4.3.4. Referenced Projects

    Sometimes it is useful to construct a working copy that is made out of a number of different checkouts. For example, you may want different subdirectories to come from different locations in a repository, or perhaps from different repositories altogether. If you want every user to have the same layout, you can define the svn:externals properties.

    Let's say you check out a working copy of /project1 to D:\dev\project1. Select the folder D:\dev\project1, right click and choose properties from the context menu. The Properties Dialog comes up. Then go to the Subversion tab. There, you can set properties. Select the svn:externals property from the combobox and write in the edit box the repository url in the format name url. For example

    subversion http://svn.collab.net/repos/svn/trunk

    Now click Set and commit your changes. If a user updates their working copy the external project is checked out, too.

    If you need more information how TortoiseSVN handles Properties read Section 4.9, “Get/Set Information About Files/Directories”.

    4.4.?取出工作副本Checking Out A Working Copy

    為了獲取一個工作副本,你必須從倉庫中做一次取出(checkout)操作。

    在資源管理器中選擇一個你想要存放工作副本的目錄。單擊鼠標右鍵跳出菜單,選擇命令Checkout…,再跳出一個窗口:

    如果你輸入一個不存在的目錄名,那這個目錄會自動創建。

    重要信息

    你只能取出到一個空目錄。假如你想要取出到先前導入的原始目錄,Subversion會拋出一個錯誤。你必須取出到另外的一個目錄或者先把原始目錄刪掉。

    強烈建議您僅取出trunk部分。假如你堅持要取出父目錄,那你有可能就會把你的硬盤塞滿,因為你將得到整個倉庫的數據(包括項目的每一個branch和tag)。

    導出Exporting

    有時候你也許需要一份沒有那些.svn目錄的工作副本,比如要建一個源代碼zip壓縮包。TortoiseSVN提供一個導出命令 Export…,可以免除我們自己動手來操作(做一個副本,然后手動刪除所有.svn目錄)。如果你在工作副本中執行這個命令,你可以選擇一個目錄用來存放沒有.svn目錄的干凈工作副本。同樣,你也可以指定是導出所有文件還是那些被版本控制的文件。

    導出的另一種方法是,用鼠標右鍵拖拽一個工作目錄到其他地方,然后選擇Subversion export here 或者 Subversion export all here

    4.5.?獲取狀態信息Getting Status Information

    當你在你的工作副本中工作的時候,你經常會需要知道哪些文件被修改過,哪些被增加,哪些被重命名,或者哪些文件是其他人修改和提交的。

    4.5.1.?覆蓋圖標Icon Overlays

    圖4.5 覆蓋圖標

    在從倉庫中取出工作副本之后,你會發現資源管理器中文件的圖標發生了變化。這就是TortoiseSVN受歡迎的一個原因。TortoiseSVN為每個文件圖標在原來的基礎上增加了一個叫做覆蓋圖標的東東。覆蓋圖標根據Subversion狀態的不同而顯示不同的圖標。

    *

    綠色圖標表示這是一個最新取出的工作副本,他的Subversion狀態是normal

    *

    當你開始編輯一個文件,這個文件的狀態就會變成modified,圖標也會變成紅色圓圈帶一個感嘆號。這樣你就可以輕易的知道自從上次更新以來都有修改過哪些文件,需要提交哪些文件。

    *

    這個黃色三角符號帶感嘆號,表示在一次update中產生了一個沖突(conflict)。

    *

    藍色加號意味著這個文件或文件夾已經被計劃加入到版本控制之下。

    紅叉叉表示相應文件或文件夾被計劃刪除(deleted),或者表示文件缺失。

    文件夾也有這樣的覆蓋圖標顯示。默認情況下只會顯示文件夾自己的狀態。但你也可以在Settings(4.21節,“TortoiseSVN的Settings”)中做一些設置,讓文件夾的圖標遞歸顯示。但這會導致覆蓋圖標顯示緩慢,因此在不太好的機器上或工作副本太大我們都不推薦這樣。

    在這樣設置之后,每個文件夾都會顯示為他下面所有文件的狀態,優先顯示順序為confilct>modified>normal。這樣你就可以輕松的看到一個文件夾是否有沖突或者修改過了。

    Slow Overlays

    You may notice that if you enable the recursive overlay for folders that the explorer slows down remarkably when browsing working copies. This depends on how big your working copy is and how much RAM Windows can use for file index caching. Usually it's only very slow the first time you browse such a directory - if you browse the same directory later again it's much faster.

    If you want to disable the recursive overlays for some folders but not for all then you can do that by creating a file called _tsvnexcluderecursive inside that folder. This will disable the recursive overlays for that folder, but not for the files or folders inside it.

    You can also disable the overlays completely for a folder by creating a file called _tsvnexcludethis inside that folder. Again, this disables the overlays only for that folder, not the folders inside it. You can define specific paths to be excluded from showing overlays on the settings page (Section 4.21.2, “The Settings Dialog, Look and Feel Tab”).

    和TortoiseCVS(CVS客戶端)不一樣,沒有被版本控制的文件是沒有覆蓋圖標的。所以這樣做,是因為覆蓋圖標的數量是有限的,我們應該節約點使用:)

    4.5.2.?資源管理器中TortoiseSVN的專欄

    和覆蓋圖標一樣有用(或更有用)的信息可以顯示在瀏覽器詳細資料視圖方式時的附加欄中。

    Simply right click on one of the headings of a column, choose More... from the context menu displayed. A dialog will appear where you can specify the columns and their order, which is displayed in the "Detailed View". Scroll down until the entries starting with SVN come into view. Check the ones you would like to have displayed and close the dialog by pressing OK. The columns will be appended to the right of those currently displayed. You can reorder them by drag and drop, or resize them, so that they fit your needs.

    技巧Tip

    If you want the current layout to be displayed in all your working copies, you may want to make this the default view.

    4.5.3.?倉庫狀態Status Of The Repository

    圖?4.6.?檢查修改Check for Modifications

    清楚地知道自己修改了哪些文件以及別人修改提交了哪些文件是很有用的。這就是命令Check For Modifications用的著的地方了。這個對話框顯示出你的工作副本中修改過的每一個文件,沒有在版本控制下的文件也會被顯示出來。點擊Check Repository按鈕,可以檢查倉庫中的改動。在做update之前,你可以這么做一下,來檢查是否有沖突的可能。

    在其中選擇文件或文件夾單擊鼠標右鍵,在菜單中我們可以選擇查看文件的差別,或者把本地的修改取消。TortoiseSVN會從倉庫中自動下載最新的版本來進行比較。

    4.5.4. Viewing Diffs

    我們經常會想要在文件里面查看哪些地方修改了。你可以先選擇已經修改的文件,單擊鼠標右鍵,選擇TortoiseSVN的命令Diff。然后會打開一個比較查看器,它會對本地的文件和倉庫中最新版本的內容進行詳細的對比。

    技巧Tip

    不在工作目錄中,或者你有多個版本的文件在一起的時候,你也可以使用比較功能:

    在資源管理器中選中你要進行比較的兩個文件(使用Ctrl鍵和鼠標),然后選擇TortoiseSVN的菜單命令Diff。最后被點選的文件(焦點所在的那個,也就被虛線矩形框住的那個)將被認為是被修改過的那個。

    4.6. 更新工作副本Update Your Working Copy With Changes From Others

    圖 4.7. 已完成更新的對話框

    有時候你想要把別人做的修改融合到自己的本地副本當中。這個把改動從服務器拿到本地的過程就是我們已經知道的updating。Updating操作可以針對一個文件,或幾個被選擇的文件,或某個目錄中的所有文件。選擇你想要進行update操作的文件和(或)文件夾,單擊鼠標右鍵,在菜單中選擇Update。這時會跳出一個窗口顯示正在update的進程。別人做的修改會合并到你的文件中,而你所做的修改會被保留。Update操作對倉庫是不會產生任何影響的。

    進程對話框用不同顏色的文字來表示不同的update動作。

    藍色

    加入到你的工作副本中的新條目。

    深紅

    從你的副本中刪除的條目。

    綠色

    成功將改動合并到本地的條目。

    亮紅

    合并改動到本地,但是有沖突需要解決。

    黑色

    所有其它的。

    如果你在更新中產生了沖突(當你和別人同時修改了同一個文件的同一行并且改動的不同會發生這種情況),對話框中會用紅色文字顯示出沖突。雙擊對應的行就可以啟動外掛程序來解決沖突。

    TortoiseSVN 同時也允許你更新工作副本到一個特定的版本,并不僅僅是最新的版本。這個命令就是Update to Revision…,他會跳出一個對話框來讓你輸入你需要的版本。

    小心Caution

    If you update a file or folder to a specific revision, you will get out of date error messages when you try to commit them! If you want to undo changes to a file and start afresh from an earlier revision, you must either use the Revert changes from this revision command from the log dialog or the Merge... menu command.

    命令Update to Revision...可以讓你的工作回復到以前的版本。比如說你的工作副本現在的版本是100,但你想要看看版本為50的時候是什么樣子,那就可以簡單的將版本更新到50即可。

    一般來說,更新一個單獨的文件到以前的版本并不太好,因為這會導致你的工作副本處于一個不一致的狀態。假如你更新的文件改過名字,有可能你只是發現那個文件消失了,因為在以前的那個版本,根本不存在那個名字的文件。如果你只是需要某個文件的老版本副本,最好在日志對話框中使用Save revision to...命令來搞定。

    警告Warning

    If you updated your working copy to an earlier revision, you must not make changes to the files! You will get out of date errors if you try to commit those changes. If you want to revert some changes in your working copy, then use the repository browser and save the file in question over the file in your working copy. Or you can use the log dialog and use the command Revert changes in this revision. This will undo only those changes made in the selected revision. Changes made after that revision will be retained. For reverting multiple revisions, you should use the merge command, where you can specify the range of revisions you want to undo.

    多個文件或文件夾Multiple Files/Folders

    If you select multiple files and folders in the explorer and then select Update, all of those files/folders are updated one by one. TortoiseSVN makes sure that all files/folders which are from the same repository are updated to the exact same revision! Even if between those updates another commit occurred.

    本地文件已存在Local File Already Exists

    Sometimes when you try to update, the update fails with a message to say that there is already a local file of the same name. This typically happens when Subversion tries to checkout a newly versioned file, and finds that an unversioned file of the same name already exists in your working folder. Subversion will never overwrite an unversioned file - it might contain something you are working on, which coincidentally has the same filename as another developer has used for his newly committed file.

    If you get this error message, the solution is simply to rename the local unversioned file. After completing the update, you can check whether the renamed file is still needed.

    If you keep getting error messages, use Check for modifications instead to list all the problem files. That way you can deal with them all at once.

    4.7. 解決沖突Resolving Conflicts

    有時候,你從倉庫更新文件時會發生一些沖突。當兩個或更多開發人員對同一個文件的某幾行做了修改,就會產生沖突。因為Subversion對你的項目一無所知,他會把沖突留給開發人員來解決。只要沖突產生了,你就應該打開有問題的文件,然后找到以“<<<<<<<”開頭的那幾行,有沖突的區域會被下面這樣標示:

    <<<<<<< filename

    ??? your changes

    =======

    ??? code merged from repository

    >>>>>>> revision

    另外,對每一個有沖突的文件,Subversion都會在你的目錄中放三個另外的文件:

    filename.ext.mine

    這個文件是更新工作副本之前,沖突文件在你的工作副本中原來的樣子。其中沒有任何沖突標記。

    filename.ext.rOLDREV

    這個文件是版本號為OLDREV時的文件。也就是你做修改之前最后一次取出的文件。

    filename.ext.rNEWREV

    這是你更新時Subversion客戶端從服務器收到的最新版本的文件。他是倉庫的最新版本。

    你可以在菜單中選擇Edit Conflict來打開一個合并工具或沖突編輯器,或者用其他編輯器來解決這個沖突。你必須決定這些代碼到底該是什么樣子,做一些必要的修改,然后保存文件。

    然后選擇菜單中的Resolved命令執行,接著提交修改到倉庫。請注意,命令Resolved并沒有真正的解決沖突,它只不過是把filename.ext.minefilename.ext.r*刪除,并允許你提交修改而已。

    4.8. 把你的修改發送到倉庫Sending Your Changes To The Repository

    發送你對工作副本的修改就是提交修改。在提交之前,你應該確認你的工作副本是最新的。你可以直接作一次Update操作,或者先Check for Modifications看看在本地或在服務器上哪些文件修改過。

    如果你的副本是最新的,并且沒有沖突,你就可以提交你的修改了。選中你想要提交的任意文件或文件夾,然后選擇在菜單中選擇Commit…

    圖 4.8. 提交對話框

    提交對話框會顯示每一個有修改的文件,包括新增的,刪除的,還有沒有版本控制的。如果你不想提交某個有修改的文件,只要不勾選那個文件就好了。如果你要提交某個沒有做版本控制的文件,只要勾選它就可以提交了。

    Commit files or folders?

    When you commit files, the commit dialog shows only the files you have selected. When you commit a folder the commit dialog will select the changed files automatically. If you forget about a new file you created, committing the folder will find it anyway. Committing a folder does not mean that every file gets marked as changed; It just makes your life easier by doing more work for you.

    Many unversioned files in the commit dialog

    If you think that the TSVN commit dialog shows you too many unversioned (e.g. compiler generated or editor backup) files, there are several ways to handle this. You can:

    add the file (or a wildcard extension) to the list of files to exclude on the settings page. This will affect every working copy you have.

    add the file to the svn:ignore list using the Add to ignore list context menu. This will only affect the directory on which you set the svn:ignore property. Using the SVN Property Dialog, you can alter the svn:ignore property for a directory.

    Read Section 4.12, “Ignoring Files And Directories” for more information.

    在提交對話框中雙擊一個有修改的文件,可以啟動外掛的比較工具來顯示修改細節。

    在按下OK按鈕之后,會出來一個顯示提交進程的對話框。

    圖 4.9. 顯示提交進程的對話框

    這個顯示進程的窗口中采用了不同顏色的文字來表示不同的提交動作。

    藍色Blue

    提交一個修改的或新的條目。

    深紅Dark red

    提交一個刪除或覆蓋操作。

    黑色Black

    其它所有條目。

    Special Folder Properties

    There are several special folder properties which can be used to help give more control over the formatting of commit log messages. Read Section 4.9, “Get/Set Information About Files/Directories” for further information.

    Integration with Bugtracking Tools

    If you have activated the bugtracking system, you could set one or more Issues in the Bug-ID / Issue-Nr: Textfield. Several Issues should be comma separated. Learn more Section 4.10, “Integration with Bugtracking Systems”.

    4.9. Get/Set Information About Files/Directories

    圖4.10. Subversion屬性頁

    有時你想得到一個文件或文件夾更細節的,比覆蓋圖標更多的信息。你可以在瀏覽器屬性對話框中得到Subversion提供的所有信息。選擇文件或文件夾,然后在菜單中選擇屬性(注意:這個屬性是資源管理器提供的那個菜單中的屬性,不在TortoiseSVN子菜單里面)。在屬性對話框中TortoiseSVN為在Subversion控制下的文件或文件夾加入了一個新的屬性頁。

    在Subversion的屬性頁,你可以看到選中文件或文件夾所有的相關信息。另外你還可以讀到或設置它的subversion屬性。你可以加入你自己的屬性,或者一些在subversion中有特殊含義的屬性。那些以svn:svn:externals就是這樣的屬性。如何使用這些擴展信息請參看4.3.4節, “Referenced Projects”。更多subversion屬性信息,請參看Subversion Manual

    要設置一個屬性,先在下拉框選擇需要的屬性名,然后在下方的輸入框中鍵入值。那些有多個值得屬性,比如忽略列表,可以分成多行來輸入。單擊Set按鈕來添加屬性到列表中。

    如果你要應用一個屬性到一個目錄下的每一個文件和目錄,注意選中Recursive復選框。

    如果你要修改一個已存在的屬性,先在列表中選中他,然后就可以修改了。

    同樣,要刪除一個已存在的屬性,可以先在列表中選中他,再單擊Remove按鈕。

    TortoiseSVN也有一些自己的特殊屬性,他們以tsvn:打頭:

    ●????????????? tsvn:minlogmsgsize設置了提交時日志的最小長度。如果你沒有輸入指定長度的信息,是不能提交的。這個功能對你在每一次做提交操作時提醒你寫一些合適的描述信息是很有用的。如果這個屬性沒有設置,或者他的值為0,那表示不填日志信息也可以。

    ●????????????? tsvn:logwidthmarker用在需要有一定格式日志信息的項目中,日志信息每行的寬度有限制(常見的是80個字符)。設置這個屬性為一個非零值,將導致2個現象:出現一個灰色線條指示最寬的寬度,還有,自動換行沒有了。這樣你就能看到自己的文字是不是寫的太長了。注意:這個功能只有在給日志顯示選擇了固定寬度字體時才能正常工作。

    ●????????????? tsvn:logtemplate用在一些有日志格式規范的項目中。這個屬性包含多行的文本,當進行一個commit操作時,這些文本就會自動插入到提交信息窗口中。接下來,你就可以在其中再加入必要的信息。注意:如果你還使用了tsvn:minlogmsgsize屬性,那一定要保證設置的長度比模板中的長,否則你將失去這個保護機制。(Note: if you are also using tsvn:minlogmsgsize, be sure to set the length longer than the template or you will lose the protection mechanism.)

    ●????????????? 在提交對話框中,你可以把有改動的文件列表粘貼進來,包括每個文件的狀態(added,modified,等)。tsvn:logfilelistenglish定義了顯示的文件狀態文字是英文還是本地語言。如果這個屬性沒有設置,默認為true

    ●????????????? TortoiseSVN可以使用拼寫檢查模塊,就像OpenOffice和Mozilla使用的。如果你安裝了這些東東,這個屬性可以決定使用哪個拼寫檢查模塊,比如你的項目的日志信息應該用哪種語言來寫。tsvn:projectlanguage設置了日志信息中拼寫檢查器要使用的語言模塊。在這里可以找到你的語言要使用的值:MSDN: Language Identifiers

    某些tsvn:屬性需要一個true或者false的值。另外,TSVN會懂得把yes當作true,把no當作false

    Set the tsvn: properties on folders

    These tsvn: properties must be set on folders for the system to work. When you commit a file or folder the properties are read from that folder. If the properties are not found there, TortoiseSVN will search upwards through the folder tree to find them until it comes to an unversioned folder, or the tree root (eg. C:\) is found. If you can be sure that each user checks out only from e.g trunk/ and not some subfolder, then it is sufficient to set the properties on trunk/. If you can't be sure, you should set the properties recursively on each subfolder. A property setting deeper in the project hierarchy overrides settings on higher levels (closer to trunk/).

    For tsvn: properties only you can use the Recursive checkbox to set the property to all subfolders in the hierarchy, without also setting it on all files.

    Commit properties

    Subversion properties are versioned. After you change or add a property you have to commit your changes.

    Conflicts on properties

    If there's a conflict on committing the changes, because another user has changed the same property, Subversion generates a .prej file. Delete this file after you have resolved the conflict.

    Automatic property setting

    You can configure subversion to set properties automatically on files and folders when they are added to the repository. Read Section 4.21, “TortoiseSVN's Settings” for further information.

    TortoiseSVN能夠和一些bug跟蹤系統整合到一起。這需要使用那些bugtraq:開頭的屬性。更多相關信息請閱讀第4.10節 “整合BUG跟蹤系統Integration with Bugtracking Systems”

    4.10. Bug跟蹤系統Integration with Bugtracking Systems

    你可以選擇為TortoiseSVN整合一套Bug跟蹤系統。要達到這個目的,你必須為目錄定義一些以bugtraq:開頭的屬性(第4.9節 獲取(修改)文件(目錄)信息):

    bugtraq: message

    這個屬性能夠激活Bug跟蹤系統。一旦這個屬性被設置,提交修改時,TortoiseSVN會要求你輸入一個流水號。而這個屬性的值將被放在日志信息的末尾,其中必須包含%BUGID%,這個%BUGID%在提交時會被流水號替換掉。這就能保證你提交的日志信息中包括Bug流水號,這個流水號經常會有一個特定的格式,并且與你的Bug跟蹤系統協調工作。比如,我們的TortoiseSVN項目就正在使用這樣的流水號:%BUGID%。(e.g the TortoiseSVN project is using Issue : %BUGID%, but this depends on your Tool.)

    bugtraq: append

    當這個屬性為true時,上面提到的BUGID將出現在日志的末尾,當為false時,BUGID將出現在日志的開頭。該屬性的有效值為true或false。假如沒有定義,系統將默認為true,這樣能夠保證已有項目正常運行。

    bugtraq: url

    將這個屬性設置為你的Bug跟蹤系統的url。這個url應該被合適的編碼過并且包含%BUGID%,%BUGID%會被輸入的流水號替換掉的。這樣,TortoiseSVN就會在日志對話框中顯示一個鏈接,你就可以通過點擊這個鏈接直接跳到Bug跟蹤系統。如果你不提供這個屬性,TortoiseSVN將只顯示那個流水號,也不會鏈接到哪里。比如:TortoiseSVN項目使用的是http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%

    bugtraq: label

    這個屬性用來指定將顯示在提交窗口中流水號輸入框前的標簽里的文字。如果沒有設置的話,默認顯示的是Bug-ID/Issue-Nr:。注意,窗口不會變化大小去適應這個標簽的,所以要保證文字不要超過20-25個字符。

    bugtraq: number

    該屬性為true時,流水號將只允許數字輸入。逗號是個例外,你可以輸入多個用逗號隔開的數字。有效的屬性值為true或者false。如果沒有定義,默認為true。

    bugtraq: warnifnoissue

    如果想要讓TortoiseSVN提醒不要輸入空流水號,那就把這個屬性設置為true。有效的屬性值為true或者false。如果沒有定義,默認為false。

    某些tsvn:屬性需要一個true或者false的值。另外,TSVN會懂得把yes當作true,把no當作false

    Set the Properties on Folders

    These properties must be set on folders for the system to work. When you commit a file or folder the properties are read from that folder. If the properties are not found there, TortoiseSVN will search upwards through the folder tree to find them until it comes to an unversioned folder, or the tree root (eg. C:\) is found. If you can be sure that each user checks out only from e.g trunk/ and not some subfolder, then it's enough if you set the properties on trunk/. If you can't be sure, you should set the properties recursively on each subfolder. A property setting deeper in the project hierarchy overrides settings on higher levels (closer to trunk/).

    For tsvn: properties only you can use the Recursive checkbox to set the property to all subfolders in the hierarchy, without also setting it on all files.

    4.11. 加入新文件和新目錄Adding New Files And Directories

    圖4.11. 沒有版本控制文件的菜單

    如果你想把在開發過程中創建了新文件或新的目錄加入到源代碼控制之下,可以這樣做:選中文件或目錄,然后在菜單中選擇Add命令。

    在把文件或目錄加入到控制之下后,這些文件或目錄就會顯示為一個added覆蓋圖標的樣子,這就意味著你應該趕緊把你的工作副本commit一下,以便其他開發人員能夠看到這些文件或目錄。添加一個文件或目錄并不會影響到倉庫!

    Many Adds

    You can also use the Add command on already versioned folders. In that case, the add dialog will show you all unversioned files inside that versioned folder. This helps if you have many new files and need them to add at once.

    要把工作副本之外的文件加入進來,可以使用拖拽來搞定:

    1.? 選中你要添加的文件先。

    2.? 按下鼠標右鍵將文件拖拽到工作副本中的某個地方。

    3.? 松開鼠標右鍵。

    4.? 在跳出來的菜單中選擇add files to Subversion here。這些文件馬上就會被復制到工作副本中并且加入到了版本控制。

    4.12. 忽略文件和目錄Ignoring Files And Directories

    圖4.12. 沒有版本控制文件的菜單

    在很多項目中,有一些文件或目錄是不應該被版本控制影響到的。包括那些編譯器產生的*.obj, *.lst,還有一些存放可執行文件的輸出目錄。當提交修改時,TSVN就會把沒有版本控制的文件列出來,占滿了提交窗口的文件列表。當然你可以選擇不顯示他們,但這樣可能會把一些需要添加的新加入的源代碼文件漏掉。

    避免這個問題的最好辦法就是把這些文件加入項目的忽略列表。這樣他們就不會再在提交窗口中出現了,而真正沒有版本控制的源文件還是會被標記顯示出來。

    在沒有版本控制的一個文件上單擊鼠標右鍵,然后在TSVN的菜單中選擇Ignore命令,這時會有一個子菜單出現,可以讓你選擇僅僅是這個文件,或者所有這個擴展名的文件。如果你最開始選中的是多個文件,那就不會有這個子菜單出現,而只能選擇把這些選中的文件或目錄加入忽略列表。

    要把一個文件從忽略列表中去掉,必須編輯父目錄的屬性,把文件名從svn:ignore屬性中移除。更多信息請閱讀第4.9節 獲取(修改)文件(目錄)信息Get/Set Information About Files/Directories

    The Global Ignore List

    Another way to ignore files is to add them to the global ignore list. The big difference here is that the global ignore list is a client property. It applies to all subversion projects, but on the client PC only. In general it is better to use the svn:ignore property where possible, because it can be applied to specific project areas, and it works for everyone who checks out the project. Read Section 4.21, “TortoiseSVN's Settings” for more information.

    4.13. 刪除、重命名、移動Deleting, Renaming And Moving

    和CVS不一樣,Subversion允許對文件和目錄進行改名和移動操作。因此在TortoiseSVN的子菜單中有delete和rename。

    圖4.13. 版本控制下文件的菜單

    如果使用TSVN刪除了一個文件或目錄,這個文件就已經從工作副本中刪除了,并被標記為刪除狀態。這個文件的父目錄將顯示為一個“deleted”覆蓋圖標。要恢復這個文件,只需對他的父目錄進行revert操作即可。

    如果要在工作副本內移動文件,可以使用鼠標來拖拽:

    1.? 選中要移動的文件或目錄。

    2.? 用鼠標右鍵拖拽他們到工作副本中一個新的目錄。

    3.? 松開鼠標右鍵。

    4.? 在跳出的菜單中選擇move files in Subversion to here

    如果一個刪除操作不是在版本控制下完成的,比如就像平常刪除文件那樣刪除的。提交時,對話框窗口還是會顯示這些刪除的文件,并讓你把他們從版本控制下刪除。所以如果忘記使用TortoiseSVN來刪除這些文件,這些都不是什么大不了的問題。

    Commit the parent folder

    Since renames and moves are done as a delete followed by an add you must commit the parent folder of the renamed/moved file. Only that way the deleted part of the rename/move will show up in the commit dialog. If you don't commit the removed part of the rename/move, it will stay behind in the repository and an update of your coworkers won't remove the old file.

    Getting a deleted file or folder back

    If you have deleted a file or a folder and already committed that delete operation to the repository, then a normal Revert can't bring it back anymore. But the file or folder is not lost at all. If you know the revision the file or folder got deleted (if you don't, use the log dialog to find out) open the repository browser and switch to that revision. Then select the file or folder you deleted, right-click and select Copy to... as the target for that copy operation select the path to your working copy.

    4.14. 取消改變Undo Changes

    如果要取消對一個文件所做的修改,只需用鼠標右鍵單擊該文件,選擇TSVN子菜單中的revert命令,在跳出的窗口中會顯示你選擇的文件,這時可以再次勾選文件,然后按下OK按鈕就好了。注意這里所做的取消修改只能返回到該文件上次update時的狀態。

    圖4.14. Revert dialog

    Undoing Changes which have been Committed

    Revert will only undo your local changes. It does not undo any changes which have already been committed. If you want to undo all the changes which were committed in a particular revision, read Section 4.15, “Revision Log Dialog” for further information.

    4.15. 修訂日志窗口Revision Log Dialog

    每一次修改和提交,都應該做好日志記錄。這樣開發過程中就有了一個詳細的記錄,以后便可找出每一個修改是如何修改以及為什么這樣修改的。

    日志對話框會顯示所有日志信息。顯示分成3個部分:

    1.????????????? 最上面部分顯示的是所有被提交的版本列表。顯示有日期時間、提交者、修訂版本號和日志信息的前面一部分。
    用藍色顯示的行表示有某些文件被復制到了這個版本。(也許是從一個分支來的)Lines shown in blue indicate that something has been copied to this development line (perhaps from a branch).

    2.????????????? 中間部分顯示的是選中版本的所有日志信息。

    3.????????????? 底部顯示的是選中版本所做修改的文件和目錄列表。

    還不僅僅是這些,對話框中還提供了很多的菜單命令可以使用。

    4.15.1. Invoking The Log Dialog

    圖4.15. 日志窗口

    有很多個地方可以調出這個日志窗口:

    1.? 從TortoiseSVN的菜單。

    2.? 從文件的屬性頁。

    3.? 完成update操作之后的窗口。這個窗口將只顯示自上次更新以來有過的版本。

    4.15.2. Getting Additional Information

    圖4.16. 日志窗口頂部窗格的右鍵菜單

    頂部窗格中的右鍵菜單功能如下:

    1.????????????? Compare with working copy 對選中版本與本地副本進行比較。默認的比較工具是TSVN提供的TortoiseMerge。如果是某個目錄的日志,就會顯示有改動文件的列表,接下來可以選擇單個文件進行改動查看。

    2.????????????? Show Differences as Unified Diff 在一個文件里面顯示所有的改動。這個操作比上面那個調用外部的比較查看器要快多了,因為TSVN只需要拿到不同,而不再需要獲取所有的文件。

    3.????????????? 保存選中版本為一個文件,這樣就可以得到這個文件的一個老版本了。這個選項只有當你選中的版本中只有一個文件被改動時才有效。

    4.????????????? Browse Repository打開倉庫瀏覽器,檢查選中的目錄。這個選項只有當日志只有一個目錄時才有效。

    5.????????????? Create tag from Revision 從選中版本創建branch或tag。這個功能很有用的。比如當你忘記創建一個tag而已經提交了一些改動,但這些改動你又不想包含到那個版本中去時。

    6.????????????? 更新工作副本到選中版本。當想把工作副本回復到以前的某個狀態,這個選項是很有用的。最好是更新整個目錄而不是只更新一個文件,否則你的工作副本就會不一致,而且你也將沒辦法提交任何改動。

    7.????????????? 恢復改動到選中版本。這個操作對倉庫沒有一點影響,只會在本地副本中進行改動的恢復。注意,它只取消那個版本的所有改動,沒有用老版本的整個文件來替換你的副本。這在要取消一個以前的改動時很有用。

    8.????????????? 檢索日志信息。這個功能可以在輸入的日志信息和Subversion創建的動作摘要中進行查找。注意:大小寫是不敏感的。

    圖4.17. 頂部窗格中選中2個文件時的菜單

    如果你一次選中兩個版本,菜單就會只剩下三個選項了:

    1.????????????? 用可視化工具來比較選中的2個版本。默認的比較工具是TSVN提供的TMerge。這個功能只對文件有效,對目錄沒用。

    2.????????????? 在一個文件中顯示這2個版本的不同點。這個對文件和目錄都有效。

    3.????????????? 檢索日志信息。和前面講到的一樣。

    圖4.18. 底部窗格的菜單

    底部窗格菜單的作用如下:

    1.? 查看選中文件在那個版本中所作的改動。這個菜單只有當文件為Modified時才有效。

    2.? 保存選中文件的相關版本。

    3.? 查看選中條目的Subversion屬性。

    4.15.3. Getting all log messages

    日志窗口一般不會顯示所有的日志的:

    1.????????????? 對一個大型倉庫來說,顯示成千上萬的改動需要花太多時間。正常情況下,開發人員只關注最近的修改。默認情況,最多會顯示100條日志。你也可以在Settings中修改這個值(見第4.21節,“TortoiseSVN的設置”)。

    2.????????????? 當查看一個branch或者tag的日志時,只會顯示創建這個特定branch的目錄到根的日志。這樣的好處是不會顯示多余的其他無關的日志信息。
    注意這只對本地副本有效。如果使用倉庫瀏覽器,日志信息會從分支的地方繼續顯示更多。

    如果想得到所有日志,先回到版本1,再按Get All

    4.15.4. Changing the log message and author

    有時候需要修改早先輸入的日志,因為各種各樣的原因,比如一個拼寫錯誤,或者要改進一些說法等等。另外還有可能需要修改提交修改的作者,比如由于忘記設置認證等等原因。

    Subversion允許任意的修改日志內容或版本作者。但這個功能默認是關閉的,因為這些修改是不能取消的(這些修改沒有在版本控制之下)。要讓這個功能起作用,必須先設置好pre-revprop-change hook。關于如何設置的細節請查閱Subversion的Hook Scripts一節。關于如何在Windows環境如何實現hooks請閱讀第3.5節“Repository Hooks”。

    為服務器配置好必需的hooks之后,就可以修改每個版本的作者和日志內容了。用TSVN修改的方法是,在先按住SHIFT鍵,再用鼠標雙擊需要修改的作者或日志欄。如果沒有按住SHIFT鍵,或沒有點擊在這2個欄上,那默認的雙擊動作(顯示選中版本的區別)就會被執行了。

    Warning

    Because Subversion's revision properties are not versioned, making modifications to such a property (for example, the svn:log commit message property) will overwrite the previous value of that property forever.

    4.15.5. Statistical Information

    按下統計按鈕(Statistics)會顯示一些關于修訂版本的有趣信息。顯示的內容包括,有多少作者在工作,他們提交了多少內容,每周的進展,等等。現在就可以知道誰在努力工作誰在偷懶了:)

    注意,這個統計頁面數據的范圍和前一個界面里日志的范圍是一樣的。所以如果只是一個版本的日志,那這里的統計信息就不會有太大的意義了。

    4.16. 分支/標記Branching / Tagging

    版本控制的一個重要特性是能將變更隔離成獨立的開發線路。這就是所謂的分支(branch)。分支常用來測試新功能,但又不會因為編譯錯誤或BUG干擾開發主線。一旦分支穩定下來,就可以把分支合并(merge)回主線(the trunk)了。

    版本控制的另一個特性是標記特殊版本(比如一個可以發布的版本),這樣有利于在任何時候重新創建一個特定的build或開發環境。這就是所謂的標記(tagging)。

    Subversion沒有什么專門的命令來branching或者tagging,而使用cheap copies來代替。Cheap copies有點像links(譯者注:就像windows系統的快捷方式),并沒有真正的進行復制操作。

    4.16.1. Creating a Branch or Tag

    在從副本創建分支或標記前,最好先確保本地與倉庫的版本一致。

    如果你是按先前的推薦組織方式存放倉庫的,那創建分支或標記會非常簡單:

    圖4.19. 分支/標記

    選中工作副本父目錄,調出菜單,選擇命令Branch/Tag。輸入分支或標記的倉庫路徑URL。把原來輸入的trunk 換成tags/tagname ,這里tagname 可能是ProjectName_v1.10.

    ??? C:/SVNRepository/trunk/ProjectName/...

    ??? C:/SVNRepository/trunk/AnotherProject/...

    ??? C:/SVNRepository/branches/ProjectName_SpecialDebugBuildBasedOn_v1.09/

    ??? C:/SVNRepository/tags/ProjectName_v1.10

    按下OK鈕,Subversion就在倉庫中用指定的目錄創建了一個cheap copy。創建分支或標記都不影響本地副本。

    如果本地有沒有提交的改動,TortoiseSVN會在創建標記時一起提交改動。

    4.16.2. To Checkout or to Switch...

    這是(不是真的)個問題。由于checkout會取出所有的數據,而switch只會傳輸修改的內容。Good for the network load, good for your patience. :-)

    為了能夠得到最新的副本進行工作,你可以:

    1.? 再次執行checkout。你可以任意次的取出副本到本地的任意地方。

    2.? 轉換當前副本到新創建的倉庫。只需再對項目的父目錄執行Switch命令。
    在下一個窗口輸入剛才創建的branch地址。選擇Head version。點擊OK。本地副本就切換到新branch或tag了。
    轉換就像更新一樣,不會丟掉本地的任何修改,而是將未提交修改合并。如果不想這樣,那就在轉換(switch)之前進行提交(commit)操作,或恢復(revert)副本到某個已提交版本(一般都選head版本)。

    圖4.20. 轉換窗口

    Subversion是不明白tags與branches的不同的。下面列出幾點區別:

    1.????????????? 標記用于創建項目在一個特殊階段的靜態快照,通常不再用于開發,而分支是用于開發的。這就是先前推薦使用/trunk /branches /tags結構的理由。當然你也可以修改/tags/中的副本,但提交時TortoiseSVN會有警告。

    2.????????????? 如果一個已經標記過的還發布了的版本,還要進行修改,正確的方法是創建一個新的分支,在新分支上做修改,再根據這個分支創建新標記。比如Version_1.0.1

    3.????????????? 如果在副本上修改并提交,則修改只體現在分支上而不是主干上。

    4.17. 合并Merging

    Where branches are used to maintain separate lines of development, at some stage you will want to merge the changes made on one branch back into the trunk, or vice versa.

    在進行合并操作之前,理解subversion中分支與合并如何工作是蠻重要的,否則可能導致很復雜的情況出現。強烈建議各位去閱讀Subversion BookBranching and Merging這一節,那里有詳細的描述和很多例子。

    There are two common use cases for merging which are handled in slightly different ways, as described below.

    4.17.1. Merging a Range of Revisions

    This method covers the case when you have made one or more revisions to a branch (or to the trunk) and you want to port those changes across to a different branch.

    Figure 4.21. The Merge Dialog

    To merge revisions you need to go to a working copy of the branch in which you want to receive the changes, often the trunk. Select Merge... from the context menu.

    In the From: field enter the full folder url of the branch or tag containing the changes you want to port into your working copy. You may also click ... to browse the repository and find the desired branch.

    Because you are porting a range of revisions from the same branch into your working copy, make sure the Use "From:" URL checkbox is checked.

    In the From Revision field enter the initial revision number. This is the revision before the changes you want to merge. Revision numbers are auto-incremented after each commit. You want to start merging the changes before the revision number is auto-incremented. For example, if your log messages look something like this:

    Rev Comments

    39. Working on MyBranch

    38. Working on trunk

    37. Working on MyBranch

    36. Create branch MyBranch

    35. Working on trunk

    34. Working on trunk

    ???????? ...

    If you now want to merge the changes from MyBranch into the trunk you have to choose 36 as the From Revision. Not 37 as you might think.

    The easiest way to find the revision you need is to click on Show Log, as this will list recent changes with their log comments. Select the revision you require in the Show Log dialog, then click on OK.

    In the To Revision field enter the last revision number in the range you want to merge. Often this will be the HEAD revision, although it doesn't need to be - you can just want to merge a single revision.

    Click OK to complete the merge.

    The merge is now complete. It's a good idea to have a look at the merge and see if it's as expected. Merging is usually quite complicated. Conflicts often arise if the branch has drifted far from the trunk.

    When you have tested the changes and come to commit this revision, your commit log message should always include the revision numbers which have been ported in the merge. If you want to apply another merge at a later time you will need to know what you have already merged, as you do not want to port a change more than once. Unfortunately merge information is not stored by Subversion. For more information about this, refer to Tracking Merges Manually in the Subversion Book

    If you want to keep this branch up to date with the trunk, you should immediately merge changes from trunk back to the this branch. Use this method and local changes won't get in your way. Of course, you should still avoid repeated merging of trunk changes, as explained above.

    If you want to see what changes will be made by a merge and see where possible conflicts may occur you can check the option Dry Run . This will force the merge command to do a merge, but not modify the working copy at all.

    Important

    Subversion can't merge a file with a folder and vice versa - only folders to folders and files to files. If you click on a file and open up the merge dialog, then you have to give a path to a file in that dialog. If you select a folder and bring up the dialog, then you must specify a folder url for the merge.

    4.17.2. Merging Two Different Trees

    This method covers the case when you have made a feature branch as discussed in the Subversion book. All trunk changes have been ported to the feature branch, week by week, and now the feature is complete you want to merge it back into the trunk. Because you have kept the feature branch synchronized with the trunk, the latest versions of branch and trunk will be absolutely identical except for your branch changes. So in this special case, you would merge by comparing the branch with the trunk.

    To merge the feature branch back into the trunk you need to go to a working copy of the trunk. Select Merge... from the context menu.

    In the From: field enter the full folder url of the trunk. This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes. You may also click ... to browse the repository.

    Because you are comparing two different trees, make sure the Use "From:" URL checkbox is not checked.

    In the To: field enter the full folder url of the feature branch.

    In both the From Revision field and the To Revision field, enter the last revision number at which the two trees were synchronized. If you are sure no-one else is making commits you can use the HEAD revision in both cases. If there is a chance that someone else may have made a commit since that synchronization, use the specific revision number to avoid losing more recent commits.

    Click OK to complete the merge.

    In this case you will not need the feature branch again because the new feature is now integrated into the trunk. The feature branch is redundant and can be deleted from the repository if required.

    4.18. 創建和應用補丁Creating and Applying Patches

    如果誰都可以隨便修改,項目將沒完沒了,永遠沒法穩定下來。怎么辦呢?通過“補丁patch”!將補丁送交給具有寫權限的開發團隊,他們先審查補丁,再決定是否提交,或者打回給作者。

    補丁文件只保存有副本與基礎版本的差異。

    4.18.1. Creating a Patch File

    First you need to make and test your changes. Then instead of using Commit... on the parent folder, you select Create Patch... This will produce a single file containing a summary of all the changes you have made since the last update from the repository. If you create a patch file, make some more changes and then create another patch, the second patch file will include both sets of changes.

    Just save the file using a filename of your choice. Patch files can have any extension you like, but by convention they should use the .patch or .diff extension. You are now ready to submit your patch file.

    4.18.2. Applying a Patch File

    Patch files are applied to your working copy. This should be done from the same folder level as was used to create the patch. If you are not sure what this is, just look at the first line of the patch file. For example, if the first file being worked on was doc/source/english/chapter1.xml and the first line in the patchfile is Index: english/chapter1.xml then you need to apply the patch to the english folder.

    In order to apply a patch file to your working copy, you need to have at least read access to the repository. The reason for this is that the merge program must reference the changes back to the revision against which they were made by the remote developer.

    From the context menu for that folder, click on Apply Patch... This will bring up a file open dialog allowing you to select the patch file to apply. By default only .patch or .diff files are shown, but you can opt for "All files". Open the file and TortoiseMerge runs to merge the changes from the patch file with your working copy. A small window lists the files which have been changed. Double click on each one in turn, review the changes and save the merged files.

    The remote developer's patch has now been applied to your working copy, so you need to commit to allow everyone else to access the changes from the repository.

    4.19. 副本重定位Relocating a working copy

    Figure 4.22. The Relocate Dialog

    If your repository has for some reason changed it's location (IP/URL). Maybe you're even stuck and can't commit and you don't want to checkout your working copy again from the new location and to move all your changed data back into the new working copy, relocate is the command you are looking for. It basically does very little: it scans all "entries" files in the .svn folder and changes the URL of the entries to the new value.

    Warning

    Don't use the relocate command to switch your working copy to a different branch! If you do that, then you will get many unexplainable error messages while updating, committing, ...

    The relocate command must only be used if the URL of the server changed!

    4.20. 倉庫瀏覽器The Repository Browser

    Sometimes you need to work directly on the repository, without having a working copy. That's what the Repository Browser is for. What the explorer and the icon overlays are for your working copy is the Repository Browser for the repository.

    Figure 4.23. The Repository Browser

    With the Repository Browser you can execute commands like copy, move, rename, ... directly on the repository.

    On the top of the Repository Browser Window you can enter the URL of the repository and the revision you want to browse. Browsing an older revision is useful if you want to e.g. recover a previously deleted file. Use the Copy To... command to do that and enter the full working copy path to where you want to recover your deleted file.

    4.21. TSVN的設置TortoiseSVN's Settings

    To find out what the different settings are for, just leave your mouse pointer a second on the editbox/checkbox... and a helpful tooltip will popup.

    4.21.1.

    圖4.24. 設置主界面

    Apart from setting your preferred language, this dialog allows you to specify (almost) every setting TortoiseSVN has.

    Language

    Selects your user interface language. What else did you expect?

    Exclude/Ignore pattern

    Exclude patterns are used to prevent unversioned files from showing up e.g. in the commit dialog. Files matching the patterns are also ignored by an import. Exclude files or directories by typing in the names or extensions. Patterns are separated by spaces e.g. bin obj *.bak *.~?? *.jar *.[Tt]mp. The first two entries refer to directories, the other four to files.

    ?Warning

    If you use the subversion configuration file to set a global-ignores pattern, it will override the settings you made here. The Subversion configuration file is accessed using the Edit as described below.?

    This exclude pattern will affect all your projects. It is not versioned, so it will not affect other users. By contrast you can also use the versioned svn:ignore property to exclude files or directories from version control. You can set the svn:ignore property using the Add to Ignore List command. After commiting every other user will have the same svn:ignore property set for this project / directory as you. If you want to remove an ignored file from svn:ignore, you have to edit the parent folder properties. Read Section 4.12, “Ignoring Files And Directories” and Section 4.9, “Get/Set Information About Files/Directories” for more information.

    Default number of log messages

    Limits the number of log messages that TortoiseSVN fetches when you first select Show Log Useful for slow connections / servers. You can always Fetch All messages.

    Edit...

    ... the subversion configuration file directly. Some settings cannot be modified directly by TortoiseSVN, and need to be set here instead. For more information about the subversion config file see the Subversion Manual . The section on Automatic Property Setting is of particular interest, and that is configured here.

    Short date / time format in log messages

    If the standard long messages use up too much space on your screen use the short format.

    Set filedates to "last commit time"

    This option tells TortoiseSVN to set the filedates to the last commit time when doing a checkout or an update. Otherwise TortoiseSVN will use the current date. If you are developing software it is generally best to use the current date because build systems normally look at the datestamps to decide which files need compiling. If you use "last commit time" and revert to an older file revision, your project may not compile as you expect it to.

    Close windows automatically

    TortoiseSVN will automatically close all progress dialogs when the action is finished without error.

    Don't close on conflicts

    Automatic window closing is suppressed if there were conflicts during an update. This option is highly recommended to avoid missing conflict reports.

    Check for newer versions

    If checked, TortoiseSVN will check once a week to see if an update is available

    Force shell icon refresh

    If checked, TortoiseSVN will refresh all the overlay icons after every operation without you having to press F5.

    ?Warning

    Explorer will refresh every visible icon, not just the status overlays. If you have a network share, or a CD-ROM or floppy showing, then explorer will go and update all the icons from their original source files, and that can be very slow, blocking the explorer process completely for many seconds.?

    4.21.2.

    Figure 4.25. The Settings Dialog, Look and Feel Tab

    This tab allows you to choose the items for which TortoiseSVN will display icon overlays. If you feel that your icon overlays are very slow (explorer is not responsive), uncheck the "Recurse into folders to fetch the status" box. You can even disable all icon overlays, but where's the fun in that?

    Figure 4.26. The Settings Dialog, Overlay Chooser Dialog

    You can also change the overlay icon set by clicking on Select Overlay Set. Note that if you change overlay set, you have to restart your computer for the changes to take effect.

    The Exclude Paths are used to tell TortoiseSVN for which paths not to show icon overlays and status columns. This is useful if you have some very big working copies containing only libraries which you won't change at all and therefore don't need the overlays. For example:

    f:\development\SVN\Subversion will disable the overlays on only that specific folder. You still can see the overlays on all files and folder inside that folder.

    f:\development\SVN\Subversion* will disable the overlays on all files and folders whose path starts with f:\development\SVN\Subversion. That means you won't see overlays for any files and folders below that path.

    The same applies to the Include Paths. Only that for those paths the overlays are shown even if the overlays are disabled for that specific drive type.

    You can also specify here which of the TortoiseSVN context menu entries will show up in the main context menu.

    4.21.3.

    Figure 4.27. The Settings Dialog, Network Tab

    Here you can configure your proxy server, if you need one to get through your company's firewall.

    You can also specify which program TortoiseSVN should use to establish a secure connection to a svn+ssh repository.

    4.21.4. /合并設置

    Figure 4.28. The Settings Dialog, Diff/Merge Tab

    Here you can define your own diff/merge programs that TortoiseSVN should use. The basic setting is to use the builtin TortoiseMerge which is installed alongside TortoiseSVN.

    Diff Program

    An external diff program used for comparing different revisions of files. You can specify the following parameters to the path:

    %base

    The original file without your changes

    %bname

    The window title for the base file

    %mine

    Your own file, with your changes

    %yname

    The window title for your file

    The window titles are not pure filenames. TortoiseSVN treats that as a name to display and creates the names accordingly. So e.g. if you're doing a diff from a file in revision 123 with a file in your working copy, the names will be filename : revision 123 and filename : working copy

    Merge Program

    An external merge program used to resolve conflicted files. You can specify the following parameters to the path. The order of the parameters depends on the merge program you use.

    %base

    the original file without your or the others changes

    %bname

    The window title for the base file

    %mine

    your own file, with your changes

    %yname

    The window title for your file

    %theirs

    the file as it is in the repository

    %tname

    The window title for the file in the repository

    %merged

    the conflicted file, the result of the merge operation

    %mname

    The window title for the merged file

    Diff Viewer

    A viewer program for unified-diff files (patch files). If you don't have one the builtin option is to use NotePad. No Parameters.

    The original Windows NotePad program does not behave well on files which do not have standard CR-LF line-endings. Since most unified diff files have pure LF line-endings, they do not view well in NotePad. However, you can download a free NotePad replacement Notepad2 which not only displays the line-endings correctly, but also colour codes the added and removed lines.

    Figure 4.29. The Settings Dialog, Diff/Merge Advanced Dialog

    In the advanced settings, you can define a different diff and merge program for every file extension. For instance you could associate Photoshop as the "Diff" Program for .jpg files :-)

    4.22. 誰動了哪一行?Who Changed Which Line?

    Figure 4.30. The Annotate / Blame Dialog

    Sometimes you need to know not only what lines have changed, but also who exactly changed specific lines in a file. That's when the Blame... command, sometimes also referred to as annotate command comes in handy.

    This command lists, for every line in a file, the author and the revision the line was changed.

    If you're not interested in changes from earlier revisions you can set the revision from which the blame should start. Set this to 1, if you want the blame for every revision.

    By default the blame file is viewed using TortoiseBlame, which highlights the different revisions to make it easier to read. If you wish to print or edit the blame file, select Use Text viewer to view blames

    Once you press OK TortoiseSVN starts retrieving the data to create the blame file. Please note: This can take several minutes to finish, depending on how much the file has changed and of course your network connection to the repository. Once the blame process has finished the result is written into a temporary file and you can view the results.

    Figure 4.31. TortoiseBlame

    TortoiseBlame, which is included with TortoiseSVN, makes the blame file easier to read. When you hover the mouse over a line in the blame info column, all lines with the same revision are shown with a darker background. Lines from other revisions which were changed by the same author are shown with a light background. The colouring may not work as clearly if you have your display set to 256 colour mode.

    If you left click on a line, all lines with the same revision are highlighted, and lines from other revisions by the same author are highlighted in a lighter colour. This highlighting is sticky, allowing you to move the mouse without losing the highlights. Click on that revision again to turn off highlighting.

    The revision comments are shown in a hint box whenever the mouse hovers over the blame info column.

    4.23. 版本路線圖Revision Graphs

    Figure 4.32. A Revision Graph

    Sometimes you need to know where branches and tags were taken from the trunk, and the ideal way to view this sort of information is as a graph or tree structure. That's when you need to use Revision Graph...

    This command analyses the revision history and attempts to create a tree showing the points at which copies were taken, and when branches/tags were deleted. Please note: It can take several minutes to retrieve all the data needed to create the revision graph, depending on how much the project has changed and of course your network connection to the repository.

    The revision graph shows several types of node:

    Added file/folder

    Items which have been added, or created by copying another file/folder are shown using a rounded rectangle.

    Deleted file/folder

    Deleted items eg. a branch which is no longer required, are shown using an octagon (rectangle with corners cut off).

    Normal file/folder

    All other items are shown using a plain rectangle.

    Note that the graph only shows the points at which items were added or deleted. Showing every revision of a project would generate an impossibly large graph for non-trivial cases.

    The revision date, author and comments are shown in a hint box whenever the mouse hovers over a revision box.

    Warning

    Because subversion cannot provide all the information required, a certain amount of interpretation is required, which can sometimes give strange results. Nevertheless, the output for the trunk will generally give useful results.?

    4.24. 最后Final Step

    Wishlist

    Even though TortoiseSVN and TortoiseMerge are free, you can support the developers by sending in patches and play an active role in the development. You can also help to cheer us up during the endless hours we spend in front of our computers.

    While working on TortoiseSVN we love to listen to music. And since we spend many hours on the project we need a lot of music. Therefore we have set up some wish-lists with our favourite music CD's and DVD's: http://tortoisesvn.tigris.org/donate.html Please also have a look at the list of people who contributed to the project by sending in patches or translations.

    posted on 2006-12-16 10:55 都市淘沙者 閱讀(59531) 評論(0)  編輯  收藏 所屬分類: VSS/SVN/Jira/Hudson/Sonar/TDD/UnitTest

    主站蜘蛛池模板: 日韩精品福利片午夜免费观着 | 免费看的成人yellow视频| 全部一级一级毛片免费看| 7777久久亚洲中文字幕| 亚洲国产高清视频| 一个人免费视频在线观看www| 亚洲av无码国产精品色午夜字幕| 久久国产免费观看精品| 一级人做人爰a全过程免费视频| 日韩亚洲欧洲在线com91tv| 亚洲&#228;v永久无码精品天堂久久| 成人福利在线观看免费视频| 在线观看日本亚洲一区 | 亚洲婷婷第一狠人综合精品| 亚洲爆乳无码专区| 亚洲一区二区三区在线观看精品中文| 免费人成视频在线观看网站| 两个人日本免费完整版在线观看1| 亚洲国产精品线观看不卡| 亚洲情a成黄在线观看动漫尤物| 免费精品一区二区三区在线观看| 精品久久久久久无码免费| 亚洲国产成人va在线观看网址| 深夜国产福利99亚洲视频| 日本免费一本天堂在线| 老司机永久免费网站在线观看| 大地资源网高清在线观看免费 | 久久青草精品38国产免费| 在线看片免费人成视频久网下载| 亚洲入口无毒网址你懂的| 久久久久se色偷偷亚洲精品av| 亚洲午夜无码久久久久| 在线视频观看免费视频18| 和日本免费不卡在线v| 久久久国产精品福利免费| 久久精品国产亚洲AV天海翼| 久久精品国产亚洲av四虎| 亚洲AV无一区二区三区久久| 亚洲情a成黄在线观看动漫尤物| 亚洲人成网站在线观看青青| 久久久久亚洲AV无码专区桃色|