国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
TortoiseSVN 操作指南
 TortoiseSVN 操作指南
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. 認(rèn)證... 5
4.3. 導(dǎo)入數(shù)據(jù)到倉庫Importing Data Into A Repository. 5
4.3.1. 倉庫規(guī)劃Repository Layout 5
4.3.2. 導(dǎo)入Import 7
4.3.3. 特殊文件Special Files. 8
4.3.4. 參考項(xiàng)目Referenced Projects. 9
4.4. 取出工作副本Checking Out A Working Copy. 9
4.5. 獲取狀態(tài)信息Getting Status Information. 10
4.5.1. 覆蓋圖標(biāo)Icon Overlays. 10
4.5.2. 資源管理器中TortoiseSVN的專欄... 12
4.5.3. 倉庫狀態(tài)Status Of The Repository. 12
4.5.4. 查看區(qū)別Viewing Diffs. 13
4.6. 更新工作副本Update Your Working Copy With Changes From Others. 13
4.7. 解決沖突Resolving Conflicts. 16
4.8. 把你的修改發(fā)送到倉庫Sending Your Changes To The Repository. 16
4.9. 獲?。ㄐ薷模┪募夸洠┬畔et/Set Information About Files/Directories. 19
4.10. 整合Bug跟蹤系統(tǒng)Integration with Bugtracking Systems. 21
4.11. 加入新文件和新目錄Adding New Files And Directories. 22
4.12. 忽略文件和目錄Ignoring Files And Directories. 23
4.13. 刪除、重命名、移動(dòng)Deleting, Renaming And Moving. 24
4.14. 取消改變Undo Changes. 25
4.15. 修訂日志窗口Revision Log Dialog. 26
4.15.1. 調(diào)用日志窗口Invoking The Log Dialog. 26
4.15.2. 獲取附加信息Getting Additional Information. 27
4.15.3. 獲取所有日志Getting all log messages. 29
4.15.4. 修改日志內(nèi)容和作者Changing the log message and author 29
4.15.5. 統(tǒng)計(jì)信息Statistical Information. 29
4.16. 分支/標(biāo)記Branching / Tagging. 30
4.16.1. 創(chuàng)建分支或標(biāo)記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. 創(chuàng)建和應(yīng)用補(bǔ)丁Creating and Applying Patches. 35
4.18.1. 創(chuàng)建補(bǔ)丁Creating a Patch File. 35
4.18.2. 應(yīng)用補(bǔ)丁Applying a Patch File. 35
4.19. 副本重定位Relocating a working copy. 36
4.20. 倉庫瀏覽器The Repository Browser 36
4.21. TSVN的設(shè)置TortoiseSVN‘s Settings. 37
4.21.1. 一般設(shè)置... 37
4.21.2. 外觀感受設(shè)置... 40
4.21.3. 網(wǎng)絡(luò)設(shè)置... 41
4.21.4. 比較/合并設(shè)置... 42
4.22. 誰動(dòng)了哪一行?Who Changed Which Line?. 45
4.23. 版本路線圖Revision Graphs. 46
4.24. 最后Final Step. 48
日常操作指南
Table of Contents
這份文檔描述TortoiseSVN的日常用法。注意這里不介紹CVS或者Subversion。
如果你需要一份Subversion的版本控制介紹,我們推薦您閱讀Subversion: The Definitive Guide 。
這份文檔像TortoiseSVN和Subversion一樣,也一直在改進(jìn)之中。如果發(fā)現(xiàn)任何錯(cuò)誤,請?jiān)卩]件列表中告訴我們,以便我們更新這份文檔。請?jiān)?,下面的一些貼圖可能不是最新軟件版本的貼圖,因?yàn)槲覀兌际窃诠ぷ髦鄟砭S護(hù)的。
使用 TortoiseSVN
圖1:在版本控制下的目錄菜單
所有TortoiseSVN命令都集成在Windows的資源管理器的菜單中。當(dāng)你在一個(gè)文件或文件夾單擊鼠標(biāo)右鍵時(shí),大多數(shù)命令都會直接顯示出來。哪些菜單顯示出來,依賴于文件或文件夾是否處于版本控制之下。
在工作副本目錄中,當(dāng)你用鼠標(biāo)右鍵拖拽文件或文件夾到一個(gè)新目錄,或者把沒有在版本控制下的文件或文件夾拖拽到版本控制下的目錄中,就會顯示另外一些命令在右鍵菜單中。
認(rèn)證
假如你試圖訪問一個(gè)有密碼保護(hù)的倉庫,一個(gè)認(rèn)證對話框會跳出來。
圖2:認(rèn)證對話框
輸入你的用戶名和密碼。那個(gè)復(fù)選框可以讓TortoiseSVN保存認(rèn)證信息在Subversion的默認(rèn)目錄中:$APPDATA\Subversion\auth。
如果你想讓Subversion和TortoiseSVN忘記你的認(rèn)證信息,你必須刪除相關(guān)的文件。
重要信息:
在Windows2000及其以上的系統(tǒng)中,認(rèn)證信息被加密保存在注冊表中。要?jiǎng)h除認(rèn)證信息,請選擇settings對話框,并且點(diǎn)擊Clear Auth Cache按鈕。
提示:
如果你是使用WindowsNT域的認(rèn)證方式,那么在輸入用戶名時(shí)要包括域名,比如:MYDOMAIN/johnd。
4.3. 導(dǎo)入數(shù)據(jù)到倉庫Importing Data Into A Repository
4.3.1. 倉庫規(guī)劃Repository Layout
在將數(shù)據(jù)導(dǎo)入到倉庫之前,你必須先想好如何組織存放你的數(shù)據(jù)。如果你使用一種我們推薦的規(guī)劃方式,你將在以后的使用中感覺到很舒服。
我們這里有很多種標(biāo)準(zhǔn)的推薦倉庫組織形式。大多數(shù)人會創(chuàng)建一個(gè)trunk目錄來存放開發(fā)的“主線”,一個(gè)branches目錄來存放支線副本,另外還有一個(gè)tags目錄來存放標(biāo)簽副本。假如一個(gè)倉庫只保存一個(gè)項(xiàng)目,經(jīng)常會創(chuàng)建這樣的幾個(gè)頂級目錄:
/trunk
/branches
/tags
如果一個(gè)倉庫存放多個(gè)項(xiàng)目,經(jīng)常會像下面這樣根據(jù)分支來規(guī)劃:
/trunk/paint
/trunk/calc
/branches/paint
/branches/calc
/tags/paint
/tags/calc
...或者根據(jù)項(xiàng)目分成多個(gè)目錄:
/paint/trunk
/paint/branches
/paint/tags
/calc/trunk
/calc/branches
/calc/tags
如果多個(gè)項(xiàng)目之間的關(guān)系不是很緊密,并且他們都是被單獨(dú)取出的,那根據(jù)項(xiàng)目來規(guī)劃會比較有意義些。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.對那些相關(guān)的項(xiàng)目(),最好根據(jù)分支來組織規(guī)劃。這樣的話,你就只有一個(gè)trunk需要checkout,而且子項(xiàng)目間的關(guān)系會更明顯。
你如果采用/trunk /tags /branches并列于根目錄的方式,那你必須為每個(gè)branch和tag復(fù)制整個(gè)trunk,也就是說這種結(jié)構(gòu)顯得更機(jī)動(dòng)些。
對不相干的項(xiàng)目來說,你可以使用多個(gè)不同的倉庫。當(dāng)你提交一個(gè)改動(dòng),版本號會是整個(gè)倉庫的版本號,而不是項(xiàng)目的版本號。2個(gè)不相干的項(xiàng)目共享一個(gè)倉庫會在版本號方面導(dǎo)致極大的不方便。Subversion和TortoiseSVN的項(xiàng)目看起來好像在同一個(gè)地址,但事實(shí)上他們在完全不同的倉庫中研發(fā)著,并且在版本號方面完全的不相干。
當(dāng)然,你可以不管上面提到的這些形式。你可以隨意發(fā)揮以滿足你或者你的團(tuán)隊(duì)的需要。記住不管你怎么選擇,那都不會是一個(gè)永久的形式,你可以在任何時(shí)候重新組織你的倉庫。因?yàn)閎ranches和tags都是很普通的目錄,只要你愿意,TortoiseSVN可以隨時(shí)移動(dòng)它們,或改名。
從一種形式轉(zhuǎn)換到另一種形式僅僅需要在服務(wù)器端做一些文件或目錄移動(dòng)操作;如果你不喜歡你倉庫的某種組織形式,盡管大膽的操作那些目錄。
到這里,如果你還沒有在你的倉庫中創(chuàng)建一個(gè)基本的目錄架構(gòu),接下來你應(yīng)該這么做:
1.       在你的硬盤中創(chuàng)建一個(gè)空目錄。
2.       在這個(gè)目錄中創(chuàng)建一個(gè)你中意的目錄組織形式。注意現(xiàn)在不要放任何文件進(jìn)去。
3.       接下來把這個(gè)結(jié)構(gòu)導(dǎo)入倉庫。在新建的那個(gè)目錄上單擊鼠標(biāo)右鍵,選擇Import…。這樣,就把你剛才創(chuàng)建的臨時(shí)目錄導(dǎo)入到倉庫的根目錄了,并創(chuàng)建了倉庫的基本架構(gòu)。
注意:你導(dǎo)入的這個(gè)目錄的目錄名是不應(yīng)該出現(xiàn)在倉庫中的,應(yīng)該只有目錄中的內(nèi)容會出現(xiàn)。比如,創(chuàng)建下面的目錄結(jié)構(gòu):
C:\Temp\New\trunk
C:\Temp\New\branches
C:\Temp\New\tags
將C:\Temp\New 導(dǎo)入到倉庫的根目錄,那么根目錄看起來應(yīng)該是這樣的:
/trunk
/branches
/tags
另外你也可以使用倉庫瀏覽器(repository browser)直接在倉庫中創(chuàng)建新目錄。
4.3.2. Import
在把你的項(xiàng)目導(dǎo)入到倉庫之前,下面的工作必須做好:
1.       把項(xiàng)目中不需要的文件刪除。(臨時(shí)文件、編譯器創(chuàng)建的文件,比如*.obj、2進(jìn)制文件等。)
2.       把目錄和子目錄中的所有文件整理一遍。雖然你可以在導(dǎo)入之后再來進(jìn)行重命名或刪除等操作,但是還是推薦你在導(dǎo)入之前把你的項(xiàng)目整理好。
現(xiàn)在,在資源管理器(windows explorer)中選擇項(xiàng)目的根目錄,單擊鼠標(biāo)右鍵,選擇Import…命令,跳出一個(gè)對話框:
在這個(gè)對話框中你需要填寫你要將項(xiàng)目導(dǎo)入倉庫的URL地址。
那個(gè)Important Message是用來記錄日志信息的。
重要信息:
和exclude pattern匹配的文件或文件夾不會被導(dǎo)入。
當(dāng)你按下OK按鈕,TortoiseSVN就開始把整個(gè)目錄樹包括所有文件導(dǎo)入到倉庫了。和前面講到的一樣,這個(gè)目錄的名字不會出現(xiàn)在倉庫中,只有目錄中的內(nèi)容會出現(xiàn)?,F(xiàn)在,你的這個(gè)項(xiàng)目就處于版本控制之下了。請注意,你剛才導(dǎo)入的這個(gè)目錄(在你本地硬盤上的這個(gè))并沒有處于版本控制下!要獲取一份處于版本控制之下的工作副本,你需要對剛導(dǎo)入的版本做一次取出(Checkout)操作。
4.3.3. Special Files
有時(shí)候你需要版本控制一個(gè)存儲著用戶個(gè)性信息的文件。也就是說這個(gè)文件每個(gè)開發(fā)者或用戶都會去修改以適應(yīng)他本地的設(shè)置。但每個(gè)用戶在進(jìn)行提交(commit)操作時(shí)都會把這個(gè)文件的修改提交給倉庫,這就使得版本控制這樣一個(gè)文件很困難。
在這種境況下,建議使用模版文件。你可以創(chuàng)建一個(gè)包含開發(fā)人員需要的所有數(shù)據(jù)的文件,把它添加到版本控制之下,然后讓開發(fā)人員取出這份文件。接下來,每個(gè)開發(fā)人員就可以給這個(gè)文件做個(gè)備份,然后給他改個(gè)名字。這樣操作之后,不管怎么修改這個(gè)備份都不再是什么問題了。
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
為了獲取一個(gè)工作副本,你必須從倉庫中做一次取出(checkout)操作。
在資源管理器中選擇一個(gè)你想要存放工作副本的目錄。單擊鼠標(biāo)右鍵跳出菜單,選擇命令Checkout…,再跳出一個(gè)窗口:
如果你輸入一個(gè)不存在的目錄名,那這個(gè)目錄會自動(dòng)創(chuàng)建。
重要信息
你只能取出到一個(gè)空目錄。假如你想要取出到先前導(dǎo)入的原始目錄,Subversion會拋出一個(gè)錯(cuò)誤。你必須取出到另外的一個(gè)目錄或者先把原始目錄刪掉。
強(qiáng)烈建議您僅取出trunk部分。假如你堅(jiān)持要取出父目錄,那你有可能就會把你的硬盤塞滿,因?yàn)槟銓⒌玫秸麄€(gè)倉庫的數(shù)據(jù)(包括項(xiàng)目的每一個(gè)branch和tag)。
導(dǎo)出Exporting
有時(shí)候你也許需要一份沒有那些.svn目錄的工作副本,比如要建一個(gè)源代碼zip壓縮包。TortoiseSVN提供一個(gè)導(dǎo)出命令 Export…,可以免除我們自己動(dòng)手來操作(做一個(gè)副本,然后手動(dòng)刪除所有.svn目錄)。如果你在工作副本中執(zhí)行這個(gè)命令,你可以選擇一個(gè)目錄用來存放沒有.svn目錄的干凈工作副本。同樣,你也可以指定是導(dǎo)出所有文件還是那些被版本控制的文件。
導(dǎo)出的另一種方法是,用鼠標(biāo)右鍵拖拽一個(gè)工作目錄到其他地方,然后選擇Subversion export here 或者 Subversion export all here。
4.5. 獲取狀態(tài)信息Getting Status Information
當(dāng)你在你的工作副本中工作的時(shí)候,你經(jīng)常會需要知道哪些文件被修改過,哪些被增加,哪些被重命名,或者哪些文件是其他人修改和提交的。
4.5.1. 覆蓋圖標(biāo)Icon Overlays
圖4.5 覆蓋圖標(biāo)
在從倉庫中取出工作副本之后,你會發(fā)現(xiàn)資源管理器中文件的圖標(biāo)發(fā)生了變化。這就是TortoiseSVN受歡迎的一個(gè)原因。TortoiseSVN為每個(gè)文件圖標(biāo)在原來的基礎(chǔ)上增加了一個(gè)叫做覆蓋圖標(biāo)的東東。覆蓋圖標(biāo)根據(jù)Subversion狀態(tài)的不同而顯示不同的圖標(biāo)。
綠色圖標(biāo)表示這是一個(gè)最新取出的工作副本,他的Subversion狀態(tài)是normal。
當(dāng)你開始編輯一個(gè)文件,這個(gè)文件的狀態(tài)就會變成modified,圖標(biāo)也會變成紅色圓圈帶一個(gè)感嘆號。這樣你就可以輕易的知道自從上次更新以來都有修改過哪些文件,需要提交哪些文件。
這個(gè)黃色三角符號帶感嘆號,表示在一次update中產(chǎn)生了一個(gè)沖突(conflict)。
藍(lán)色加號意味著這個(gè)文件或文件夾已經(jīng)被計(jì)劃加入到版本控制之下。
紅叉叉表示相應(yīng)文件或文件夾被計(jì)劃刪除(deleted),或者表示文件缺失。
文件夾也有這樣的覆蓋圖標(biāo)顯示。默認(rèn)情況下只會顯示文件夾自己的狀態(tài)。但你也可以在Settings(4.21節(jié),“TortoiseSVN的Settings”)中做一些設(shè)置,讓文件夾的圖標(biāo)遞歸顯示。但這會導(dǎo)致覆蓋圖標(biāo)顯示緩慢,因此在不太好的機(jī)器上或工作副本太大我們都不推薦這樣。
在這樣設(shè)置之后,每個(gè)文件夾都會顯示為他下面所有文件的狀態(tài),優(yōu)先顯示順序?yàn)閏onfilct>modified>normal。這樣你就可以輕松的看到一個(gè)文件夾是否有沖突或者修改過了。
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客戶端)不一樣,沒有被版本控制的文件是沒有覆蓋圖標(biāo)的。所以這樣做,是因?yàn)楦采w圖標(biāo)的數(shù)量是有限的,我們應(yīng)該節(jié)約點(diǎn)使用:)
4.5.2. 資源管理器中TortoiseSVN的專欄
和覆蓋圖標(biāo)一樣有用(或更有用)的信息可以顯示在瀏覽器詳細(xì)資料視圖方式時(shí)的附加欄中。
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. 倉庫狀態(tài)Status Of The Repository
圖 4.6. 檢查修改Check for Modifications
清楚地知道自己修改了哪些文件以及別人修改提交了哪些文件是很有用的。這就是命令Check For Modifications用的著的地方了。這個(gè)對話框顯示出你的工作副本中修改過的每一個(gè)文件,沒有在版本控制下的文件也會被顯示出來。點(diǎn)擊Check Repository按鈕,可以檢查倉庫中的改動(dòng)。在做update之前,你可以這么做一下,來檢查是否有沖突的可能。
在其中選擇文件或文件夾單擊鼠標(biāo)右鍵,在菜單中我們可以選擇查看文件的差別,或者把本地的修改取消。TortoiseSVN會從倉庫中自動(dòng)下載最新的版本來進(jìn)行比較。
4.5.4. Viewing Diffs
我們經(jīng)常會想要在文件里面查看哪些地方修改了。你可以先選擇已經(jīng)修改的文件,單擊鼠標(biāo)右鍵,選擇TortoiseSVN的命令Diff。然后會打開一個(gè)比較查看器,它會對本地的文件和倉庫中最新版本的內(nèi)容進(jìn)行詳細(xì)的對比。
技巧Tip
不在工作目錄中,或者你有多個(gè)版本的文件在一起的時(shí)候,你也可以使用比較功能:
在資源管理器中選中你要進(jìn)行比較的兩個(gè)文件(使用Ctrl鍵和鼠標(biāo)),然后選擇TortoiseSVN的菜單命令Diff。最后被點(diǎn)選的文件(焦點(diǎn)所在的那個(gè),也就被虛線矩形框住的那個(gè))將被認(rèn)為是被修改過的那個(gè)。
更新工作副本Update Your Working Copy With Changes From Others
圖 4.7. 已完成更新的對話框
有時(shí)候你想要把別人做的修改融合到自己的本地副本當(dāng)中。這個(gè)把改動(dòng)從服務(wù)器拿到本地的過程就是我們已經(jīng)知道的updating。Updating操作可以針對一個(gè)文件,或幾個(gè)被選擇的文件,或某個(gè)目錄中的所有文件。選擇你想要進(jìn)行update操作的文件和(或)文件夾,單擊鼠標(biāo)右鍵,在菜單中選擇Update。這時(shí)會跳出一個(gè)窗口顯示正在update的進(jìn)程。別人做的修改會合并到你的文件中,而你所做的修改會被保留。Update操作對倉庫是不會產(chǎn)生任何影響的。
進(jìn)程對話框用不同顏色的文字來表示不同的update動(dòng)作。
藍(lán)色
加入到你的工作副本中的新條目。
深紅
從你的副本中刪除的條目。
綠色
成功將改動(dòng)合并到本地的條目。
亮紅
合并改動(dòng)到本地,但是有沖突需要解決。
黑色
所有其它的。
如果你在更新中產(chǎn)生了沖突(當(dāng)你和別人同時(shí)修改了同一個(gè)文件的同一行并且改動(dòng)的不同會發(fā)生這種情況),對話框中會用紅色文字顯示出沖突。雙擊對應(yīng)的行就可以啟動(dòng)外掛程序來解決沖突。
TortoiseSVN 同時(shí)也允許你更新工作副本到一個(gè)特定的版本,并不僅僅是最新的版本。這個(gè)命令就是Update to Revision…,他會跳出一個(gè)對話框來讓你輸入你需要的版本。
小心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...可以讓你的工作回復(fù)到以前的版本。比如說你的工作副本現(xiàn)在的版本是100,但你想要看看版本為50的時(shí)候是什么樣子,那就可以簡單的將版本更新到50即可。
一般來說,更新一個(gè)單獨(dú)的文件到以前的版本并不太好,因?yàn)檫@會導(dǎo)致你的工作副本處于一個(gè)不一致的狀態(tài)。假如你更新的文件改過名字,有可能你只是發(fā)現(xiàn)那個(gè)文件消失了,因?yàn)樵谝郧暗哪莻€(gè)版本,根本不存在那個(gè)名字的文件。如果你只是需要某個(gè)文件的老版本副本,最好在日志對話框中使用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.
多個(gè)文件或文件夾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.
解決沖突Resolving Conflicts
有時(shí)候,你從倉庫更新文件時(shí)會發(fā)生一些沖突。當(dāng)兩個(gè)或更多開發(fā)人員對同一個(gè)文件的某幾行做了修改,就會產(chǎn)生沖突。因?yàn)镾ubversion對你的項(xiàng)目一無所知,他會把沖突留給開發(fā)人員來解決。只要沖突產(chǎn)生了,你就應(yīng)該打開有問題的文件,然后找到以“<<<<<<<”開頭的那幾行,有沖突的區(qū)域會被下面這樣標(biāo)示:
<<<<<<< filename
your changes
=======
code merged from repository
>>>>>>> revision
另外,對每一個(gè)有沖突的文件,Subversion都會在你的目錄中放三個(gè)另外的文件:
filename.ext.mine
這個(gè)文件是更新工作副本之前,沖突文件在你的工作副本中原來的樣子。其中沒有任何沖突標(biāo)記。
filename.ext.rOLDREV
這個(gè)文件是版本號為OLDREV時(shí)的文件。也就是你做修改之前最后一次取出的文件。
filename.ext.rNEWREV
這是你更新時(shí)Subversion客戶端從服務(wù)器收到的最新版本的文件。他是倉庫的最新版本。
你可以在菜單中選擇Edit Conflict來打開一個(gè)合并工具或沖突編輯器,或者用其他編輯器來解決這個(gè)沖突。你必須決定這些代碼到底該是什么樣子,做一些必要的修改,然后保存文件。
然后選擇菜單中的Resolved命令執(zhí)行,接著提交修改到倉庫。請注意,命令Resolved并沒有真正的解決沖突,它只不過是把filename.ext.mine 和 filename.ext.r*刪除,并允許你提交修改而已。
把你的修改發(fā)送到倉庫Sending Your Changes To The Repository
發(fā)送你對工作副本的修改就是提交修改。在提交之前,你應(yīng)該確認(rèn)你的工作副本是最新的。你可以直接作一次Update操作,或者先Check for Modifications看看在本地或在服務(wù)器上哪些文件修改過。
如果你的副本是最新的,并且沒有沖突,你就可以提交你的修改了。選中你想要提交的任意文件或文件夾,然后選擇在菜單中選擇Commit…。
圖 4.8. 提交對話框
提交對話框會顯示每一個(gè)有修改的文件,包括新增的,刪除的,還有沒有版本控制的。如果你不想提交某個(gè)有修改的文件,只要不勾選那個(gè)文件就好了。如果你要提交某個(gè)沒有做版本控制的文件,只要勾選它就可以提交了。
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.
在提交對話框中雙擊一個(gè)有修改的文件,可以啟動(dòng)外掛的比較工具來顯示修改細(xì)節(jié)。
在按下OK按鈕之后,會出來一個(gè)顯示提交進(jìn)程的對話框。
圖 4.9. 顯示提交進(jìn)程的對話框
這個(gè)顯示進(jìn)程的窗口中采用了不同顏色的文字來表示不同的提交動(dòng)作。
藍(lán)色Blue
提交一個(gè)修改的或新的條目。
深紅Dark red
提交一個(gè)刪除或覆蓋操作。
黑色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屬性頁
有時(shí)你想得到一個(gè)文件或文件夾更細(xì)節(jié)的,比覆蓋圖標(biāo)更多的信息。你可以在瀏覽器屬性對話框中得到Subversion提供的所有信息。選擇文件或文件夾,然后在菜單中選擇屬性(注意:這個(gè)屬性是資源管理器提供的那個(gè)菜單中的屬性,不在TortoiseSVN子菜單里面)。在屬性對話框中TortoiseSVN為在Subversion控制下的文件或文件夾加入了一個(gè)新的屬性頁。
在Subversion的屬性頁,你可以看到選中文件或文件夾所有的相關(guān)信息。另外你還可以讀到或設(shè)置它的subversion屬性。你可以加入你自己的屬性,或者一些在subversion中有特殊含義的屬性。那些以svn:和svn:externals就是這樣的屬性。如何使用這些擴(kuò)展信息請參看4.3.4節(jié), “Referenced Projects”。更多subversion屬性信息,請參看Subversion Manual
要設(shè)置一個(gè)屬性,先在下拉框選擇需要的屬性名,然后在下方的輸入框中鍵入值。那些有多個(gè)值得屬性,比如忽略列表,可以分成多行來輸入。單擊Set按鈕來添加屬性到列表中。
如果你要應(yīng)用一個(gè)屬性到一個(gè)目錄下的每一個(gè)文件和目錄,注意選中Recursive復(fù)選框。
如果你要修改一個(gè)已存在的屬性,先在列表中選中他,然后就可以修改了。
同樣,要?jiǎng)h除一個(gè)已存在的屬性,可以先在列表中選中他,再單擊Remove按鈕。
TortoiseSVN也有一些自己的特殊屬性,他們以tsvn:打頭:
●              tsvn:minlogmsgsize設(shè)置了提交時(shí)日志的最小長度。如果你沒有輸入指定長度的信息,是不能提交的。這個(gè)功能對你在每一次做提交操作時(shí)提醒你寫一些合適的描述信息是很有用的。如果這個(gè)屬性沒有設(shè)置,或者他的值為0,那表示不填日志信息也可以。
●              tsvn:logwidthmarker用在需要有一定格式日志信息的項(xiàng)目中,日志信息每行的寬度有限制(常見的是80個(gè)字符)。設(shè)置這個(gè)屬性為一個(gè)非零值,將導(dǎo)致2個(gè)現(xiàn)象:出現(xiàn)一個(gè)灰色線條指示最寬的寬度,還有,自動(dòng)換行沒有了。這樣你就能看到自己的文字是不是寫的太長了。注意:這個(gè)功能只有在給日志顯示選擇了固定寬度字體時(shí)才能正常工作。
●              tsvn:logtemplate用在一些有日志格式規(guī)范的項(xiàng)目中。這個(gè)屬性包含多行的文本,當(dāng)進(jìn)行一個(gè)commit操作時(shí),這些文本就會自動(dòng)插入到提交信息窗口中。接下來,你就可以在其中再加入必要的信息。注意:如果你還使用了tsvn:minlogmsgsize屬性,那一定要保證設(shè)置的長度比模板中的長,否則你將失去這個(gè)保護(hù)機(jī)制。(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.)
●              在提交對話框中,你可以把有改動(dòng)的文件列表粘貼進(jìn)來,包括每個(gè)文件的狀態(tài)(added,modified,等)。tsvn:logfilelistenglish定義了顯示的文件狀態(tài)文字是英文還是本地語言。如果這個(gè)屬性沒有設(shè)置,默認(rèn)為true。
●              TortoiseSVN可以使用拼寫檢查模塊,就像OpenOffice和Mozilla使用的。如果你安裝了這些東東,這個(gè)屬性可以決定使用哪個(gè)拼寫檢查模塊,比如你的項(xiàng)目的日志信息應(yīng)該用哪種語言來寫。tsvn:projectlanguage設(shè)置了日志信息中拼寫檢查器要使用的語言模塊。在這里可以找到你的語言要使用的值:MSDN: Language Identifiers。
某些tsvn:屬性需要一個(gè)true或者false的值。另外,TSVN會懂得把yes當(dāng)作true,把no當(dāng)作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跟蹤系統(tǒng)整合到一起。這需要使用那些bugtraq:開頭的屬性。更多相關(guān)信息請閱讀第4.10節(jié) “整合BUG跟蹤系統(tǒng)Integration with Bugtracking Systems”
4.10. Bug跟蹤系統(tǒng)Integration with Bugtracking Systems
你可以選擇為TortoiseSVN整合一套Bug跟蹤系統(tǒng)。要達(dá)到這個(gè)目的,你必須為目錄定義一些以bugtraq:開頭的屬性(第4.9節(jié) 獲?。ㄐ薷模┪募夸洠┬畔?/a>):
bugtraq:message
這個(gè)屬性能夠激活Bug跟蹤系統(tǒng)。一旦這個(gè)屬性被設(shè)置,提交修改時(shí),TortoiseSVN會要求你輸入一個(gè)流水號。而這個(gè)屬性的值將被放在日志信息的末尾,其中必須包含%BUGID%,這個(gè)%BUGID%在提交時(shí)會被流水號替換掉。這就能保證你提交的日志信息中包括Bug流水號,這個(gè)流水號經(jīng)常會有一個(gè)特定的格式,并且與你的Bug跟蹤系統(tǒng)協(xié)調(diào)工作。比如,我們的TortoiseSVN項(xiàng)目就正在使用這樣的流水號:%BUGID%。(e.g the TortoiseSVN project is using Issue : %BUGID%, but this depends on your Tool.)
bugtraq:append
當(dāng)這個(gè)屬性為true時(shí),上面提到的BUGID將出現(xiàn)在日志的末尾,當(dāng)為false時(shí),BUGID將出現(xiàn)在日志的開頭。該屬性的有效值為true或false。假如沒有定義,系統(tǒng)將默認(rèn)為true,這樣能夠保證已有項(xiàng)目正常運(yùn)行。
bugtraq:url
將這個(gè)屬性設(shè)置為你的Bug跟蹤系統(tǒng)的url。這個(gè)url應(yīng)該被合適的編碼過并且包含%BUGID%,%BUGID%會被輸入的流水號替換掉的。這樣,TortoiseSVN就會在日志對話框中顯示一個(gè)鏈接,你就可以通過點(diǎn)擊這個(gè)鏈接直接跳到Bug跟蹤系統(tǒng)。如果你不提供這個(gè)屬性,TortoiseSVN將只顯示那個(gè)流水號,也不會鏈接到哪里。比如:TortoiseSVN項(xiàng)目使用的是http://tortoisesvn.tigris.org/issues/show_bug.cgi?id=%BUGID%
bugtraq:label
這個(gè)屬性用來指定將顯示在提交窗口中流水號輸入框前的標(biāo)簽里的文字。如果沒有設(shè)置的話,默認(rèn)顯示的是Bug-ID/Issue-Nr:。注意,窗口不會變化大小去適應(yīng)這個(gè)標(biāo)簽的,所以要保證文字不要超過20-25個(gè)字符。
bugtraq:number
該屬性為true時(shí),流水號將只允許數(shù)字輸入。逗號是個(gè)例外,你可以輸入多個(gè)用逗號隔開的數(shù)字。有效的屬性值為true或者false。如果沒有定義,默認(rèn)為true。
bugtraq:warnifnoissue
如果想要讓TortoiseSVN提醒不要輸入空流水號,那就把這個(gè)屬性設(shè)置為true。有效的屬性值為true或者false。如果沒有定義,默認(rèn)為false。
某些tsvn:屬性需要一個(gè)true或者false的值。另外,TSVN會懂得把yes當(dāng)作true,把no當(dāng)作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.
加入新文件和新目錄Adding New Files And Directories
圖4.11. 沒有版本控制文件的菜單
如果你想把在開發(fā)過程中創(chuàng)建了新文件或新的目錄加入到源代碼控制之下,可以這樣做:選中文件或目錄,然后在菜單中選擇Add命令。
在把文件或目錄加入到控制之下后,這些文件或目錄就會顯示為一個(gè)added覆蓋圖標(biāo)的樣子,這就意味著你應(yīng)該趕緊把你的工作副本commit一下,以便其他開發(fā)人員能夠看到這些文件或目錄。添加一個(gè)文件或目錄并不會影響到倉庫!
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.
要把工作副本之外的文件加入進(jìn)來,可以使用拖拽來搞定:
1.  選中你要添加的文件先。
2.  按下鼠標(biāo)右鍵將文件拖拽到工作副本中的某個(gè)地方。
3.  松開鼠標(biāo)右鍵。
4.  在跳出來的菜單中選擇add files to Subversion here。這些文件馬上就會被復(fù)制到工作副本中并且加入到了版本控制。
忽略文件和目錄Ignoring Files And Directories
圖4.12. 沒有版本控制文件的菜單
在很多項(xiàng)目中,有一些文件或目錄是不應(yīng)該被版本控制影響到的。包括那些編譯器產(chǎn)生的*.obj, *.lst,還有一些存放可執(zhí)行文件的輸出目錄。當(dāng)提交修改時(shí),TSVN就會把沒有版本控制的文件列出來,占滿了提交窗口的文件列表。當(dāng)然你可以選擇不顯示他們,但這樣可能會把一些需要添加的新加入的源代碼文件漏掉。
避免這個(gè)問題的最好辦法就是把這些文件加入項(xiàng)目的忽略列表。這樣他們就不會再在提交窗口中出現(xiàn)了,而真正沒有版本控制的源文件還是會被標(biāo)記顯示出來。
在沒有版本控制的一個(gè)文件上單擊鼠標(biāo)右鍵,然后在TSVN的菜單中選擇Ignore命令,這時(shí)會有一個(gè)子菜單出現(xiàn),可以讓你選擇僅僅是這個(gè)文件,或者所有這個(gè)擴(kuò)展名的文件。如果你最開始選中的是多個(gè)文件,那就不會有這個(gè)子菜單出現(xiàn),而只能選擇把這些選中的文件或目錄加入忽略列表。
要把一個(gè)文件從忽略列表中去掉,必須編輯父目錄的屬性,把文件名從svn:ignore屬性中移除。更多信息請閱讀
第4.9節(jié) 獲?。ㄐ薷模┪募夸洠┬畔et/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.
刪除、重命名、移動(dòng)Deleting, Renaming And Moving
和CVS不一樣,Subversion允許對文件和目錄進(jìn)行改名和移動(dòng)操作。因此在TortoiseSVN的子菜單中有delete和rename。
圖4.13. 版本控制下文件的菜單
如果使用TSVN刪除了一個(gè)文件或目錄,這個(gè)文件就已經(jīng)從工作副本中刪除了,并被標(biāo)記為刪除狀態(tài)。這個(gè)文件的父目錄將顯示為一個(gè)“deleted”覆蓋圖標(biāo)。要恢復(fù)這個(gè)文件,只需對他的父目錄進(jìn)行revert操作即可。
如果要在工作副本內(nèi)移動(dòng)文件,可以使用鼠標(biāo)來拖拽:
1.  選中要移動(dòng)的文件或目錄。
2.  用鼠標(biāo)右鍵拖拽他們到工作副本中一個(gè)新的目錄。
3.  松開鼠標(biāo)右鍵。
4.  在跳出的菜單中選擇move files in Subversion to here。
如果一個(gè)刪除操作不是在版本控制下完成的,比如就像平常刪除文件那樣刪除的。提交時(shí),對話框窗口還是會顯示這些刪除的文件,并讓你把他們從版本控制下刪除。所以如果忘記使用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.
取消改變Undo Changes
如果要取消對一個(gè)文件所做的修改,只需用鼠標(biāo)右鍵單擊該文件,選擇TSVN子菜單中的revert命令,在跳出的窗口中會顯示你選擇的文件,這時(shí)可以再次勾選文件,然后按下OK按鈕就好了。注意這里所做的取消修改只能返回到該文件上次update時(shí)的狀態(tài)。
圖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.
修訂日志窗口Revision Log Dialog
每一次修改和提交,都應(yīng)該做好日志記錄。這樣開發(fā)過程中就有了一個(gè)詳細(xì)的記錄,以后便可找出每一個(gè)修改是如何修改以及為什么這樣修改的。
日志對話框會顯示所有日志信息。顯示分成3個(gè)部分:
1.              最上面部分顯示的是所有被提交的版本列表。顯示有日期時(shí)間、提交者、修訂版本號和日志信息的前面一部分。
用藍(lán)色顯示的行表示有某些文件被復(fù)制到了這個(gè)版本。(也許是從一個(gè)分支來的)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. 日志窗口
有很多個(gè)地方可以調(diào)出這個(gè)日志窗口:
1.  從TortoiseSVN的菜單。
2.  從文件的屬性頁。
3.  完成update操作之后的窗口。這個(gè)窗口將只顯示自上次更新以來有過的版本。
4.15.2. Getting Additional Information
圖4.16. 日志窗口頂部窗格的右鍵菜單
頂部窗格中的右鍵菜單功能如下:
1.              Compare with working copy 對選中版本與本地副本進(jìn)行比較。默認(rèn)的比較工具是TSVN提供的TortoiseMerge。如果是某個(gè)目錄的日志,就會顯示有改動(dòng)文件的列表,接下來可以選擇單個(gè)文件進(jìn)行改動(dòng)查看。
2.              Show Differences as Unified Diff 在一個(gè)文件里面顯示所有的改動(dòng)。這個(gè)操作比上面那個(gè)調(diào)用外部的比較查看器要快多了,因?yàn)門SVN只需要拿到不同,而不再需要獲取所有的文件。
3.              保存選中版本為一個(gè)文件,這樣就可以得到這個(gè)文件的一個(gè)老版本了。這個(gè)選項(xiàng)只有當(dāng)你選中的版本中只有一個(gè)文件被改動(dòng)時(shí)才有效。
4.              Browse Repository打開倉庫瀏覽器,檢查選中的目錄。這個(gè)選項(xiàng)只有當(dāng)日志只有一個(gè)目錄時(shí)才有效。
5.              Create tag from Revision 從選中版本創(chuàng)建branch或tag。這個(gè)功能很有用的。比如當(dāng)你忘記創(chuàng)建一個(gè)tag而已經(jīng)提交了一些改動(dòng),但這些改動(dòng)你又不想包含到那個(gè)版本中去時(shí)。
6.              更新工作副本到選中版本。當(dāng)想把工作副本回復(fù)到以前的某個(gè)狀態(tài),這個(gè)選項(xiàng)是很有用的。最好是更新整個(gè)目錄而不是只更新一個(gè)文件,否則你的工作副本就會不一致,而且你也將沒辦法提交任何改動(dòng)。
7.              恢復(fù)改動(dòng)到選中版本。這個(gè)操作對倉庫沒有一點(diǎn)影響,只會在本地副本中進(jìn)行改動(dòng)的恢復(fù)。注意,它只取消那個(gè)版本的所有改動(dòng),沒有用老版本的整個(gè)文件來替換你的副本。這在要取消一個(gè)以前的改動(dòng)時(shí)很有用。
8.              檢索日志信息。這個(gè)功能可以在輸入的日志信息和Subversion創(chuàng)建的動(dòng)作摘要中進(jìn)行查找。注意:大小寫是不敏感的。
圖4.17. 頂部窗格中選中2個(gè)文件時(shí)的菜單
如果你一次選中兩個(gè)版本,菜單就會只剩下三個(gè)選項(xiàng)了:
1.              用可視化工具來比較選中的2個(gè)版本。默認(rèn)的比較工具是TSVN提供的TMerge。這個(gè)功能只對文件有效,對目錄沒用。
2.              在一個(gè)文件中顯示這2個(gè)版本的不同點(diǎn)。這個(gè)對文件和目錄都有效。
3.              檢索日志信息。和前面講到的一樣。
圖4.18. 底部窗格的菜單
底部窗格菜單的作用如下:
1.  查看選中文件在那個(gè)版本中所作的改動(dòng)。這個(gè)菜單只有當(dāng)文件為Modified時(shí)才有效。
2.  保存選中文件的相關(guān)版本。
3.  查看選中條目的Subversion屬性。
4.15.3. Getting all log messages
日志窗口一般不會顯示所有的日志的:
1.              對一個(gè)大型倉庫來說,顯示成千上萬的改動(dòng)需要花太多時(shí)間。正常情況下,開發(fā)人員只關(guān)注最近的修改。默認(rèn)情況,最多會顯示100條日志。你也可以在Settings中修改這個(gè)值(見第4.21節(jié),“TortoiseSVN的設(shè)置”)。
2.              當(dāng)查看一個(gè)branch或者tag的日志時(shí),只會顯示創(chuàng)建這個(gè)特定branch的目錄到根的日志。這樣的好處是不會顯示多余的其他無關(guān)的日志信息。
注意這只對本地副本有效。如果使用倉庫瀏覽器,日志信息會從分支的地方繼續(xù)顯示更多。
如果想得到所有日志,先回到版本1,再按Get All。
4.15.4. Changing the log message and author
有時(shí)候需要修改早先輸入的日志,因?yàn)楦鞣N各樣的原因,比如一個(gè)拼寫錯(cuò)誤,或者要改進(jìn)一些說法等等。另外還有可能需要修改提交修改的作者,比如由于忘記設(shè)置認(rèn)證等等原因。
Subversion允許任意的修改日志內(nèi)容或版本作者。但這個(gè)功能默認(rèn)是關(guān)閉的,因?yàn)檫@些修改是不能取消的(這些修改沒有在版本控制之下)。要讓這個(gè)功能起作用,必須先設(shè)置好pre-revprop-change hook。關(guān)于如何設(shè)置的細(xì)節(jié)請查閱Subversion的Hook Scripts一節(jié)。關(guān)于如何在Windows環(huán)境如何實(shí)現(xiàn)hooks請閱讀第3.5節(jié)“Repository Hooks”。
為服務(wù)器配置好必需的hooks之后,就可以修改每個(gè)版本的作者和日志內(nèi)容了。用TSVN修改的方法是,在先按住SHIFT鍵,再用鼠標(biāo)雙擊需要修改的作者或日志欄。如果沒有按住SHIFT鍵,或沒有點(diǎn)擊在這2個(gè)欄上,那默認(rèn)的雙擊動(dòng)作(顯示選中版本的區(qū)別)就會被執(zhí)行了。
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
按下統(tǒng)計(jì)按鈕(Statistics)會顯示一些關(guān)于修訂版本的有趣信息。顯示的內(nèi)容包括,有多少作者在工作,他們提交了多少內(nèi)容,每周的進(jìn)展,等等。現(xiàn)在就可以知道誰在努力工作誰在偷懶了:)
注意,這個(gè)統(tǒng)計(jì)頁面數(shù)據(jù)的范圍和前一個(gè)界面里日志的范圍是一樣的。所以如果只是一個(gè)版本的日志,那這里的統(tǒng)計(jì)信息就不會有太大的意義了。
分支/標(biāo)記Branching / Tagging
版本控制的一個(gè)重要特性是能將變更隔離成獨(dú)立的開發(fā)線路。這就是所謂的分支(branch)。分支常用來測試新功能,但又不會因?yàn)榫幾g錯(cuò)誤或BUG干擾開發(fā)主線。一旦分支穩(wěn)定下來,就可以把分支合并(merge)回主線(the trunk)了。
版本控制的另一個(gè)特性是標(biāo)記特殊版本(比如一個(gè)可以發(fā)布的版本),這樣有利于在任何時(shí)候重新創(chuàng)建一個(gè)特定的build或開發(fā)環(huán)境。這就是所謂的標(biāo)記(tagging)。
Subversion沒有什么專門的命令來branching或者tagging,而使用cheap copies來代替。Cheap copies有點(diǎn)像links(譯者注:就像windows系統(tǒng)的快捷方式),并沒有真正的進(jìn)行復(fù)制操作。
4.16.1. Creating a Branch or Tag
在從副本創(chuàng)建分支或標(biāo)記前,最好先確保本地與倉庫的版本一致。
如果你是按先前的推薦組織方式存放倉庫的,那創(chuàng)建分支或標(biāo)記會非常簡單:
圖4.19. 分支/標(biāo)記
選中工作副本父目錄,調(diào)出菜單,選擇命令Branch/Tag。輸入分支或標(biāo)記的倉庫路徑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就在倉庫中用指定的目錄創(chuàng)建了一個(gè)cheap copy。創(chuàng)建分支或標(biāo)記都不影響本地副本。
如果本地有沒有提交的改動(dòng),TortoiseSVN會在創(chuàng)建標(biāo)記時(shí)一起提交改動(dòng)。
4.16.2. To Checkout or to Switch...
這是(不是真的)個(gè)問題。由于checkout會取出所有的數(shù)據(jù),而switch只會傳輸修改的內(nèi)容。Good for the network load, good for your patience. :-)
為了能夠得到最新的副本進(jìn)行工作,你可以:
1.  再次執(zhí)行checkout。你可以任意次的取出副本到本地的任意地方。
2.  轉(zhuǎn)換當(dāng)前副本到新創(chuàng)建的倉庫。只需再對項(xiàng)目的父目錄執(zhí)行Switch命令。
在下一個(gè)窗口輸入剛才創(chuàng)建的branch地址。選擇Head version。點(diǎn)擊OK。本地副本就切換到新branch或tag了。
轉(zhuǎn)換就像更新一樣,不會丟掉本地的任何修改,而是將未提交修改合并。如果不想這樣,那就在轉(zhuǎn)換(switch)之前進(jìn)行提交(commit)操作,或恢復(fù)(revert)副本到某個(gè)已提交版本(一般都選head版本)。
圖4.20. 轉(zhuǎn)換窗口
Subversion是不明白tags與branches的不同的。下面列出幾點(diǎn)區(qū)別:
1.              標(biāo)記用于創(chuàng)建項(xiàng)目在一個(gè)特殊階段的靜態(tài)快照,通常不再用于開發(fā),而分支是用于開發(fā)的。這就是先前推薦使用/trunk /branches /tags結(jié)構(gòu)的理由。當(dāng)然你也可以修改/tags/中的副本,但提交時(shí)TortoiseSVN會有警告。
2.              如果一個(gè)已經(jīng)標(biāo)記過的還發(fā)布了的版本,還要進(jìn)行修改,正確的方法是創(chuàng)建一個(gè)新的分支,在新分支上做修改,再根據(jù)這個(gè)分支創(chuàng)建新標(biāo)記。比如Version_1.0.1。
3.              如果在副本上修改并提交,則修改只體現(xiàn)在分支上而不是主干上。
合并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.
在進(jìn)行合并操作之前,理解subversion中分支與合并如何工作是蠻重要的,否則可能導(dǎo)致很復(fù)雜的情況出現(xiàn)。強(qiáng)烈建議各位去閱讀Subversion BookBranching and Merging這一節(jié),那里有詳細(xì)的描述和很多例子。
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.
創(chuàng)建和應(yīng)用補(bǔ)丁Creating and Applying Patches
如果誰都可以隨便修改,項(xiàng)目將沒完沒了,永遠(yuǎn)沒法穩(wěn)定下來。怎么辦呢?通過“補(bǔ)丁patch”!將補(bǔ)丁送交給具有寫權(quán)限的開發(fā)團(tuán)隊(duì),他們先審查補(bǔ)丁,再決定是否提交,或者打回給作者。
補(bǔ)丁文件只保存有副本與基礎(chǔ)版本的差異。
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.
副本重定位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!
倉庫瀏覽器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.
的設(shè)置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. 設(shè)置主界面
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. /合并設(shè)置
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 :-)
誰動(dòng)了哪一行?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.
版本路線圖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.
最后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.
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=376604
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
svn branch、tag & merge
sourceforge----svn的建立
TortoiseSVN客戶端命令
TortoiseSVN使用說明
TortoiseSVN?的使用
Subversion客戶端使用詳解
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服