SVN 批處理自動更新和提交指定資料夾內容
在開發中每天可能都要去去更新新的文案 美術等資源,這裡我們就分享一下如何批處理更新指定檔案的內容
一、更新指定檔案內容
新建一個bat檔案
更新bat檔案所在資料夾的資源:
TortoiseProc.exe /command:update /path:".\" /closeonend:0
指定更新資料夾內容:
TortoiseProc.exe /command:update /path:"D:/test/" /closeonend:0
更新多個離散檔案的內容:
TortoiseProc.exe /command:update /path:"D:/test0/*D:/test1/" /closeonend:0
二、提交指定檔案內容
提交bat檔案所在資料夾的資源:
TortoiseProc.exe /command:commit /path:".\" /logmsg:"svn提交顯示內容" /closeonend:0
離散檔案提交方式同第一個。
三、關於在bat指定過程中直接隱藏cmd命令視窗
在執行bat檔案時,感覺彈出cmd彈框,不美觀,下面就是如何隱藏執行視窗:
@echo off if "%1" == "h" goto begin mshta vbscript:createobject("wscript.shell").run("%~nx0 h",0)(window.close)&&exit :begin
只用放在bat檔案的開頭即可。
四、常見svn命令列說明:
命令 | 描述 |
---|---|
:about | 顯示關於對話方塊。如果沒有給命令也會顯示。 |
:log | 開啟日誌對話方塊,/path 指定了顯示日誌的檔案或目錄,另外還有三個選項可以設定: /startrev:xxx 、/endrev:xxx 和/strict |
:checkout | 開啟檢出對話方塊,/path 指定了目標路徑,而/url 制定了檢出的URL。 |
:import | 開啟匯入對話方塊,/path 指定了資料匯入路徑。 |
:update | 將工作副本的/path 更新到HEAD,如果給定引數/rev ,就會彈出一個對話方塊詢問使用者需要更新到哪個修訂版本。為了防止指定修訂版本號/rev:1234 的對話方塊,需要選項/nonrecursive 和/ignoreexternals 。 |
:commit | 開啟提交對話方塊,/path 指定了目標路徑或需要提交的檔案列表,你也可以使用引數 /logmsg 給提交視窗傳遞預定義的日誌資訊,或者你不希望將日誌傳遞給命令列,你也可以使用 /logmsgfile:path ,path 指向了儲存日誌資訊的檔案。為了預先填入bug的ID(如果你設定了整合bug追蹤屬性),你可以使用/bugid:"the bug id here" 完成這個任務。 |
:add | 將/path 的檔案新增到版本控制 。 |
:revert | 恢復工作副本的本地修改,/path 說明恢復哪些條目。 |
:cleanup | 清理中斷和終止的操作,將工作副本的/path 解鎖。 |
:resolve | 將/path 指定檔案的衝突標示為解決,如果給定/noquestion ,解決不會向用戶確認操作。 |
:repocreate | 在/path 建立一個版本庫。 |
:switch | 開啟選項對話方塊。/path 指定目標目錄。 |
:export | 將/path 的工作副本匯出到另一個目錄,如果/path 指向另一個未版本控制目錄,對話方塊會詢問要匯出到/path 的URL。 |
:merge | Opens the merge dialog. The /path specifies the target directory. For merging a revision range, the following options are available: /fromurl:URL , /revrange:string . For merging two repository trees, the following options are available: /fromurl:URL , /tourl:URL , /fromrev:xxx and /torev:xxx . These pre-fill the relevant fields in the merge dialog. |
:mergeall | Opens the merge all dialog. The /path specifies the target directory. |
:copy | Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. You can also specify the /logmsg switch to pass a predefined log message to the branch/tag dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:path , where path points to a file containing the log message. |
:settings | 開啟設定對話方塊。 |
:remove | 從版本控制裡移除/path 中的檔案。 |
:rename | 重新命名/path 的檔案,會在對話方塊中詢問新檔案,為了防止一個步驟中詢問相似檔案,傳遞/noquestion 。 |
:diff | Starts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx . If /blame is set and /path2 is not set, then the diff is done by first blaming the files with the given revisions. |
:showcompare | Depending on the URLs and revisions to compare, this either shows a unified diff (if the option The options |
:conflicteditor | Starts the conflict editor specified in the TortoiseSVN settings with the correct files for the conflicted file in /path . |
:relocate | 開啟重定位對話方塊,/path 指定了重定位的工作副本路徑。 |
:help | 開啟幫助檔案 |
:repostatus | 開啟為修改檢出對話方塊,/path 指定了工作副本目錄。 |
:repobrowser | Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL. An additional option /rev:xxx can be used to specify the revision which the repository browser should show. If the /rev:xxx is omitted, it defaults to HEAD. If /path points to an URL, the /projectpropertiespath:path/to/wc specifies the path from where to read and use the project properties. |
:ignore | 將/path 中的物件加入到忽略列表,也就是將這些檔案新增到 svn:ignore 屬性。 |
:blame | 為 如果設定了 如果設定了 也支援 |
:cat | 將/path 指定的工作副本或URL的檔案儲存到/savepath:path ,修訂版本號在/revision:xxx ,這樣可以得到特定修訂版本的檔案。 |
:createpatch | 建立/path 下的補丁檔案。 |
:revisiongraph | 顯示/path 目錄下的版本變化圖。 |
:lock | Locks a file or all files in a directory given in /path . The 'lock' dialog is shown so the user can enter a comment for the lock. |
:unlock | Unlocks a file or all files in a directory given in /path . |
:rebuildiconcache | Rebuilds the windows icon cache. Only use this in case the windows icons are corrupted. A side effect of this (which can't be avoided) is that the icons on the desktop get rearranged. To suppress the message box, pass /noquestion . |
:properties | 顯示 /path 給出的路徑之屬性對話方塊。 |
關於結尾closeonend:0型別解釋:
/closeonend:0 不自動關閉對話方塊
/closeonend:1 如果沒發生錯誤則自動關閉對話方塊
/closeonend:2 如果沒發生錯誤和衝突則自動關閉對話方塊
/closeonend:3如果沒有錯誤、衝突和合並,會自動關閉
/closeonend:4如果沒有錯誤、衝突和合並,會自動關閉