客戶端cli的使用
WC:Working Copy 你的工作區
將文件或目錄版本化,這樣下一次提交到存儲庫的時候,他們就都會被提交上去。能實現版本化的命令有:
add
1.import
是否訪問存儲庫:是
格式:
import [PATH] URL
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --auto-props : enable automatic properties 啟用自動屬性 --force : force operation to run 強制操作運行 --no-auto-props : disable automatic properties 禁用自動屬性 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor-cmd 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG --no-ignore : disregard default and svn:ignore and svn:global-ignores property ignores 忽略默認值和svn:ignore和svn:global-ignores屬性忽略 Global options: --username ARG : specify a username ARG 指定用戶名為ARG --password ARG : specify a password ARG (caution: on many operating systems, other users will be able to see this) 指定密碼為ARG(警告:在許多操作系統上,其他用戶將能夠看到這一點) --password-from-stdin : read password from stdin 從標准輸入中讀取密碼 --no-auth-cache : do not cache authentication tokens 不存儲驗證令牌 --non-interactive : do no interactive prompting (default is to prompt only if standard input is a terminal device) 不要進行交互提示(默認情況下,只有在標准輸入是終端設備時才會提示) --force-interactive : do interactive prompting even if standard input is not a terminal device 即使標准輸入不是終端設備,也會有交互提示 --trust-server-cert : deprecated; same as --trust-server-cert-failures=unknown-ca 已棄用,與--trust-server-cert-failures=unknown-ca的功能相同 --trust-server-cert-failures ARG : with --non-interactive, accept SSL server certificates with failures; 與--non-interactive標志一起接受SSL服務器證書與故障; ARG is comma-separated list of ARG是一個逗號分隔的列表 'unknown-ca' (Unknown Authority), 包含“Unknown -ca”(未知權限) 'cn-mismatch' (Hostname mismatch), “cn-mismatch”(主機名錯配) 'expired' (Expired certificate), “expired”(過期證書) 'not-yet-valid' (Not yet valid certificate) “Not -yet-valid”(還不是有效證書) 'other' (all other not separately classified certificate errors). “other”(所有其他未單獨分類的證書錯誤) --config-dir ARG : read user configuration files from directory ARG 從目錄中讀取用戶配置文件 --config-option ARG : set user configuration option in the format:FILE:SECTION:OPTION=[VALUE] 在格式FILE:SECTION:OPTION=[VALUE]中設置用戶配置選項 For example:servers:global:http-library=serf
將未版本化的文件或樹[PATH]提交到存儲庫URL中
將會遞歸地將路徑的副本提交到URL。如果路徑被省略,將假設使用的是 '.',即本地當前路徑。
根據自己的需要在存儲庫中創建父目錄。如果[PATH]是一個目錄,則目錄的內容直接添加到URL下。
如果指定了--force,則忽略設備文件和管道等不可版本項。
舉例:
userdeMBP:~ user$ svn import /Users/user/centos7-virtualbox svn://localhost/myCode/centos7 --username=boss --password=00000 -m "初始化導入centos7的vagrantfile文件" Adding centos7-virtualbox/.vagrant Adding centos7-virtualbox/.vagrant/machines Adding centos7-virtualbox/.vagrant/machines/default Adding centos7-virtualbox/.vagrant/machines/default/virtualbox Adding centos7-virtualbox/.vagrant/machines/default/virtualbox/vagrant_cwd Adding centos7-virtualbox/.vagrant/rgloader Adding centos7-virtualbox/.vagrant/rgloader/loader.rb Adding centos7-virtualbox/Vagrantfile Committing transaction... Committed revision 1.
本例子就是將本地的文件目錄/Users/user/centos7-virtualbox提交到svn://localhost/myCode/centos7目錄中中,用戶名為boss,密碼為00000,注釋為“初始化導入centos7的vagrantfile文件”
2.checkout(縮寫為co)
是否訪問存儲庫:否
格式:
checkout URL[@REV]... [PATH]
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂數量 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --force : force operation to run 強制操作運行 --ignore-externals : ignore externals definitions 忽略外部定義 Global options: //與上面相同,在此省略
從存儲庫中檢出工作副本到指定的PATH下
舉例:
userdeMBP:~ user$ svn checkout svn://localhost/myCode --username=boss --password=00000 /Users/user/foo A foo/centos7 A foo/centos7/.vagrant A foo/centos7/.vagrant/machines A foo/centos7/.vagrant/machines/default A foo/centos7/.vagrant/machines/default/virtualbox A foo/centos7/.vagrant/machines/default/virtualbox/vagrant_cwd A foo/centos7/.vagrant/rgloader A foo/centos7/.vagrant/rgloader/loader.rb A foo/centos7/Vagrantfile Checked out revision 1.
本例子就是從svn://localhost/myCode存儲庫中得到所有的存儲內容並放到本地的/Users/user/foo目錄下
3.commit (ci)
是否訪問存儲庫:是
格式:
commit [PATH...]
⚠️默認必須提供日志信息,即使用-m
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --targets ARG : pass contents of file ARG as additional args 將文件ARG的內容作為附加參數傳遞 --no-unlock : don't unlock the targets 不要解鎖目標 -m [--message] ARG : specify log message ARG 指定日志信息為ARG -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG成員進行操作 --keep-changelists : don't delete changelists after commit 提交后不要刪除更改列表 --include-externals : also operate on externals defined by svn:externals properties 還對由svn:externals屬性定義的外部性進行操作 Global options: //與上面相同,在此省略
將更改從工作副本發送到存儲庫
必須提供日志消息,但它可以是空的。如果--message或--file選項不提供此選項,則將啟動編輯器。
如果任何目標是(或包含)鎖定的項,則在成功提交之后將解鎖這些項,除非--no-unlock。
如果--include-externals給定,還提交遞歸到達的外部文件和目錄。不要使用固定的修訂提交外部文件。
舉例:
userdeMBP:foo user$ svn commit -m "修改了Vagrantfile文件的config.vm.box_check_update配置項" Sending centos7/Vagrantfile Transmitting file data .done Committing transaction... Committed revision 2.
當你對相應的文件進行了修改,並且想要講修改上傳時就使用commit,然后修改處的修訂版本號就是變成2,並且有相應的注釋"修改了Vagrantfile文件的config.vm.box_check_update配置項"
4.update (up)
是否訪問存儲庫:是
格式:
update [PATH...]
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂數量 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --set-depth ARG : set new working copy depth to ARG ('exclude','empty', 'files', 'immediates', or 'infinity') 將新的工作拷貝深度設置為ARG ('exclude','empty', 'files', 'immediate ', or 'infinity') -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --diff3-cmd ARG : use ARG as merge command 使用ARG作為合並命令 --force : handle unversioned obstructions as changes 將未版本化的障礙作為更改處理 --ignore-externals : ignore externals definitions 忽略外部定義 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG成員進行操作 --editor-cmd ARG : use ARG as external editor 使用ARG作為外部編輯器 --accept ARG : specify automatic conflict resolution action 指定自動沖突解決操作 ('postpone', 'working', 'base', 'mine-conflict','theirs-conflict', 'mine-full', 'theirs-full', 'edit', 'launch', 'recommended') (shorthand:'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l', 'r') 對應的縮寫 --parents : make intermediate directories 創建中間目錄 --adds-as-modification : Local additions are merged with incoming additions instead of causing a tree conflict. Use of this option is not recommended! Use 'svn resolve' to resolve tree conflicts instead. 本地添加與傳入添加合並,而不是導致樹沖突。 不建議使用此選項!應該通過使用“svn resolve”來解決樹沖突。 Global options: //與上面相同,在此省略
將更改從存儲庫帶到工作副本中,即如果有別的用戶更新了某個文件,然后你想要同步更新到你本地的文件,你就可以使用update
如果沒有給出修訂號(即-r參數),那么返回帶着最新的工作副本和HEAD rev。否則,將工作副本同步到-r給出的修訂號版本。
對於每個更新的項目,將打印一行,其中包含報告所采取的操作的字符。這些字的意思如下:
- A Added 添加
- D Deleted 刪除
- U Updated 更新
- C Conflict 有沖突
- G Merged 合並
- E Existed 已存在
- R Replaced 替換
第一列中的字符報告關於項本身的內容。
第二列中的字符報告項的屬性。
第三列中的“B”表示文件的鎖已被破壞或被盜。
第四列中的“C”表示樹沖突,而第一列和第二列中的“C”分別表示文件和屬性值中的文本沖突。
如果使用--force,當更新試圖添加相同的路徑,工作副本中的未版本化阻塞路徑不會自動導致失敗。如果阻塞路徑與存儲庫中相應路徑的類型(文件或目錄)相同,則會對其進行版本控制,但其內容將“原樣”保留在工作副本中。
這意味着一個阻塞目錄的未版本化的子目錄也可能阻塞並成為版本化的。對於文件,阻塞和存儲庫之間的任何內容差異都被視為對工作副本的本地修改。存儲庫中的所有屬性都應用於阻塞路徑。
在第一列中使用代碼“E”報告阻塞路徑。
如果工作副本中缺少指定的更新目標,但存在其直接父目錄,則在指定的深度將目標簽入其父目錄。
如果指定了--parent,也可以在depth=empty處簽出目標的任何缺失的父目錄。
使用--set-depth選項在此操作的目標上設置新的工作副本深度。
舉例:
userdeMBP:foo user$ svn update Updating '.': At revision 4.
本例子的作用就是將之前使用checkout檢出的工作副本同步到最新版本,沒有指定路徑則默認為本地路徑'.'。由上面返回結果可見,現在的最新版本為4
5. add
是否訪問存儲可:否
格式:
add PATH...
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 將ARG文件的內容作為附加參數傳遞 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --force : force operation to run 強制操作運行 --no-ignore : disregard default and svn:ignore and svn:global-ignores property ignores 忽略默認值和svn:ignore和svn:global-ignores屬性忽略 --auto-props : enable automatic properties 啟用自動屬性 --no-auto-props : disable automatic properties 禁用自動屬性 --parents : add intermediate parents 添加中間父目錄 Global options: //與上面相同,在此省略
將文件和目錄置於版本控制之下,安排它們添加到存儲庫。它們將在下一次提交中添加。
舉例:
在之前的工作副本foo中創建了兩個文件來查看add的作用及效果:
userdeMBP:~ user$ svn list svn://localhost/myCode //首先先查看當前存儲庫中有的文件和目錄列表 centos7/ userdeMBP:~ user$ svn add /Users/user/foo/versioned-1 A foo/versioned-1 //A表示添加 userdeMBP:~ user$ cd foo userdeMBP:foo user$ svn commit -m "查看add的使用效果add了versioned-1文件" //然后進入到我的工作副本區,運行commit提交操作 Adding versioned-1 Transmitting file data .done Committing transaction... Committed revision 5. //然后我們就能夠看見,使用版本化后的versioned-1被提交到了存儲庫中,沒有版本化的unversioned-1沒有被提交上去 userdeMBP:foo user$ svn list svn://localhost/myCode centos7/ versioned-1
6.auth
格式:
usage: 1. svn auth [PATTERN ...] usage: 2. svn auth --remove PATTERN [PATTERN ...]
如果沒有參數,則列出所有緩存的身份驗證憑據。身份驗證憑證包括用戶名、密碼、SSL證書和SSL客戶機證書密碼。
如果指定了模式,則只列出屬性與一個或多個模式匹配的憑據。
使用--remove選項,刪除匹配一個或多個模式的緩存身份驗證憑據。
如果指定了多個模式,則僅當它們與所有指定模式匹配時才考慮憑證。模式是區分大小寫匹配的,可能包含glob通配符:
- ? 匹配任何單個字符
- * 匹配任意字符序列
- [abc] 匹配括號中列出的任何字符
請注意,通配符通常需要在命令行中被引用或轉義,因為許多命令shell會通過嘗試展開它們來進行干擾。
選項:
Valid options: --remove : remove matching authentication credentials 刪除匹配的身份驗證憑據 --show-passwords : show cached passwords 顯示緩存密碼 Global options: //與上面相同,在此省略
舉例:
userdeMBP:~ user$ svn auth ------------------------------------------------------------------------ Credential kind: svn.simple Authentication realm: <http://10.249.1.139:80> svn Password cache: keychain Username: user ------------------------------------------------------------------------ Credential kind: svn.simple Authentication realm: <svn://localhost:3690> ae9a497d-29...fac365743 Password cache: keychain Username: boss Credentials cache in '/Users/user/.subversion' contains 2 credentials
7.blame (praise, annotate, ann) 追責
是否訪問存儲庫:是
格式:
blame [-rM:N] TARGET[@REV]...
在文件的每一行注釋上一個版本號,以及該行的最后一個更改(或者下一個更改)的作者。
如果沒有修訂范圍(與-r0:REV相同),或者有'-r M:N'(其中M < N),則對在文件的修訂號N中出現的每一行進行注釋,最后一個修訂是在rN處或rN修訂號之前修改或添加該行的,向后查看的時間不超過rM。
在一個反向修訂范圍'-r M:N'中,其中M > N,注釋文件的修訂N中出現的每一行,在rN修改或刪除該行之后的下一個修訂中,向前看的時間不超過rM。
如果-r指定了修訂號,則[@REV]中的REV將確定首先查找目標的修訂版本。
將帶注釋的結果寫入標准輸出。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂數量 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -v [--verbose] : print extra information 打印額外信息 -g [--use-merge-history] : use/display additional information from merge history 使用/顯示合並歷史記錄中的附加信息 --incremental : give output suitable for concatenation 給出適合串聯的輸出 --xml : output in XML 以XML格式輸出 -x [--extensions] ARG : Specify differencing options for external diff or internal diff or blame. Default: '-u'. 為外部差異或內部差異或過失指定差異選項。默認值:'-u'。 Options are separated by spaces. Internal diff and blame take: 選項由空格分隔。內部差異和責備采取: -u, --unified: Show 3 lines of unified context 顯示3行統一上下文 -b, --ignore-space-change: Ignore changes in amount of white space 忽略空白數量的更改 -w, --ignore-all-space: Ignore all white space 忽略所有空白 --ignore-eol-style: Ignore changes in EOL style 忽略EOL樣式的更改 -U ARG, --context ARG: Show ARG lines of context 顯示ARG上下文的行 -p, --show-c-function: Show C function name 顯示C函數名 --force : force operation to run 強制運行操作 Global options: //與上面相同,在此省略
顯示文件的每一行何時最后(或下一行)更改。顯示特定文件和URL內嵌的作者和修訂版本信息
即顯示某個已受控文件的每一行的最后修改版本和作者
舉例:
1)
userdeMBP:~ user$ svn blame svn://localhost/myCode/centos7/Vagrantfile 1 boss # -*- mode: ruby -*- 1 boss # vi: set ft=ruby : 1 boss 1 boss # All Vagrant configuration is done below. The "2" in Vagrant.configure 1 boss # configures the configuration version (we support older styles for 1 boss # backwards compatibility). Please don't change it unless you know what 1 boss # you're doing. 1 boss Vagrant.configure("2") do |config| 1 boss # The most common configuration options are documented and commented below. 1 boss # For a complete reference, please see the online documentation at 1 boss # https://docs.vagrantup.com. 1 boss 1 boss # Every Vagrant development environment requires a box. You can search for 1 boss # boxes at https://vagrantcloud.com/search. 1 boss config.vm.box = "centos/7" 1 boss 1 boss # Disable automatic box update checking. If you disable this, then 1 boss # boxes will only be checked for updates when the user runs 1 boss # `vagrant box outdated`. This is not recommended. 2 boss config.vm.box_check_update = false
...
2)使用--xml:
userdeMBP:~ user$ svn blame --xml svn://localhost/myCode/versioned-1 <?xml version="1.0" encoding="UTF-8"?> <blame> <target path="svn://localhost/myCode/versioned-1"> <entry line-number="1"> <commit revision="5"> <author>boss</author> <date>2019-01-07T02:14:12.922068Z</date> </commit> </entry> </target> </blame>
3)使用-r number參數,得到修訂版本號為number的文件的每一行的最后修改版本和作者:
userdeMBP:foo user$ svn blame --revision 5 svn://localhost/myCode/versioned-1 svn: E220001: Unreadable path encountered; access denied
出錯,解決辦法,在authz文件上添加下圖畫圈處的內容:
然后再運行即可:
userdeMBP:foo user$ svn blame --revision 5 svn://localhost/myCode/versioned-1 5 boss use add command to make this file versioned
4)-r 修訂范圍正反的區別:
1》正常時,顯示的是從一開始到修訂版本號為4的信息:
userdeMBP:foo user$ svn blame --revision 4 svn://localhost/myCode/centos7/Vagrantfile 1 boss # -*- mode: ruby -*- 1 boss # vi: set ft=ruby : ... 1 boss # boxes will only be checked for updates when the user runs 1 boss # `vagrant box outdated`. This is not recommended. 4 boss config.vm.box_check_update = false 1 boss 1 boss # Create a forwarded port mapping which allows access to a specific port 1 boss # within the machine from a port on the host machine. In the example below, 1 boss # accessing "localhost:8080" will access port 80 on the guest machine. 1 boss # NOTE: This will enable public access to the opened port 4 boss config.vm.network "forwarded_port", guest: 80, host: 8080 1 boss ... 1 boss # SHELL 1 boss end
2》指定正向修訂版本范圍:
只顯示在2-4版本內修改的內容,-處的內容因為修訂版本為1,所以不顯示;並且顯示的內容盡量朝4接近,即如果某一行版本3、版本4都有,那么就顯示其版本4的內容:
userdeMBP:foo user$ svn blame --revision 2:4 svn://localhost/myCode/centos7/Vagrantfile - - # -*- mode: ruby -*- - - # vi: set ft=ruby : ... - - # boxes will only be checked for updates when the user runs - - # `vagrant box outdated`. This is not recommended. 4 boss config.vm.box_check_update = false - - - - # Create a forwarded port mapping which allows access to a specific port - - # within the machine from a port on the host machine. In the example below, - - # accessing "localhost:8080" will access port 80 on the guest machine. - - # NOTE: This will enable public access to the opened port 4 boss config.vm.network "forwarded_port", guest: 80, host: 8080 - - - - # Create a forwarded port mapping which allows access to a specific port ... - - # SHELL - - end
3》指定反向修訂版本范圍:
只顯示在2-4版本內修改的內容,-處的內容因為修訂版本為1,所以不顯示;不同之處在於顯示的內容盡量朝2接近,即如果某一行版本3、版本4都有,那么就顯示其版本3的內容:
userdeMBP:foo user$ svn blame --revision 4:2 svn://localhost/myCode/centos7/Vagrantfile - - # -*- mode: ruby -*- - - # vi: set ft=ruby : ... - - # `vagrant box outdated`. This is not recommended. 3 boss config.vm.box_check_update = false - - - - # Create a forwarded port mapping which allows access to a specific port - - # within the machine from a port on the host machine. In the example below, - - # accessing "localhost:8080" will access port 80 on the guest machine. - - # NOTE: This will enable public access to the opened port 4 boss # config.vm.network "forwarded_port", guest: 80, host: 8080 - - ... - - # SHELL - - end
8.cat
格式:
cat TARGET[@REV]...
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 --ignore-keywords : don't expand keywords 不擴展密鑰 Global options: //與上面相同,在此省略
取得在特定版本的某文件顯示在當前屏幕
如果指定,[@REV]中的REV將確定首先查找目標的修訂版本。
舉例:
userdeMBP:~ user$ svn cat svn://localhost/myCode/centos7/Vagrantfile@4 # -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "centos/7" # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port config.vm.network "forwarded_port", guest: 80, host: 8080
...
然后我就得到了修訂號為4的制定文件的內容
注意:
svn log 用來展示svn 的版本作者、日期、路徑等等
svn diff 通過比較來顯示特定修改的行級詳細信息
svn cat 取得在特定版本的某文件顯示在當前屏幕
svn list 顯示存儲庫中一個目錄或某一版本存在的文件
9.changelist (cl)
是否訪問存儲庫:否
格式:
usage: 1. changelist CLNAME PATH... 2. changelist --remove PATH...
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -R [--recursive] : descend recursively, same as --depth=infinity 一路向下遞歸,效果就和--depth=infinity相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --remove : remove changelist association 刪除變更列表協會 --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 --changelist [--cl] ARG : operate only on members of changelist ARG 只對ARG這個changelist成員進行操作 Global options: //與上面相同,在此省略
將變化列表CLNAME與命名文件關聯(或分離),即將wc中的文件從邏輯上分組.
通過這個命令,我們可以給自己的本地代碼改動分組或加上一個標簽,說明某些文件是為某個特別功能或bug而改的
舉例:
userdeMBP:~ user$ svn cl centos7_file /Users/user/foo/centos7/Vagrantfile
A [centos7_file] foo/centos7/Vagrantfile
centos7_file為變更列表的名字,/Users/user/foo/centos7/Vagrantfile為本地的文件,這樣就是將該文件分到了centos7_file這個組中,如果之后還想要添加別的文件還可以繼續執行該語句
創建一個changelist之后,我們就可以針對這個changelist而不是單個文件進行操作了
后面又添加了一個versioned-1文件到該組:
userdeMBP:foo user$ svn cl centos7_file /Users/user/foo/versioned-1 A [centos7_file] versioned-1
然后對上面的centos7_file組中的文件進行修改,然后將其提交到存儲庫中:
userdeMBP:~ user$ svn commit --changelist centos7_file -m "centos7_file group file" //注意,操作相應的文件的時候一定要在其工作副本中,否則操作不成功 svn: E155007: '/Users/user' is not a working copy userdeMBP:~ user$ cd foo //我的工作副本是'/Users/user/foo' userdeMBP:foo user$ svn commit --changelist centos7_file -m "centos7_file group file" //然后就可以看見提交了centos7_file組中的兩個文件 Sending centos7/Vagrantfile Sending versioned-1 Transmitting file data ..done Committing transaction... Committed revision 6.
然后可以通過cat查看一下:
userdeMBP:foo user$ svn cat svn://localhost/myCode/versioned-1@6 //成功 use add command to make this file versioned and now test changelist userdeMBP:foo user$ svn cat svn://localhost/myCode/centos7/Vagrantfile@6 //成功 # -*- mode: ruby -*- # vi: set ft=ruby : #test changeless # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing.
10.cleanup
是否訪問存儲庫:否
格式:
usage: 1. cleanup [WCPATH...] 2. cleanup --remove-unversioned [WCPATH...] cleanup --remove-ignored [WCPATH...] 3. cleanup --vacuum-pristines [WCPATH...]
- 如果沒有指定任何選項,如--remove-unversioned, --remove-ignored, and --vacuum-pristines,則從工作副本中刪除所有鎖定項目(通過“svn status”命令顯示為“L”)。通常,只有當Subversion客戶機在使用工作副本時崩潰,使其處於不可用狀態時,才需要這樣做。
⚠️:沒有保護其他Subversion客戶端仍在使用的寫鎖的機制。當另一個客戶端使用工作副本時,在沒有任何選項的情況下運行此命令會損壞工作副本,無法修復!
- 如果給出了--remove-unversioned選項或--remove-ignore選項,則刪除WCPATH中的任何未版本化或忽略的項。
⚠️'svn status'命令將未版本化的項顯示為'?',如果給它提供了--no-ignore 選項,則忽略項為“I”。
- 如果給出--vacuum-pristines選項,則刪除存儲在.svn目錄中且不再被工作副本中的任何文件引用的文件的原始副本。
選項:
Valid options: --remove-unversioned : remove unversioned items 移除非版本化項目,即沒有調用add命令的文件 --remove-ignored : remove ignored items 移除忽略的項目 --vacuum-pristines : remove unreferenced pristines from .svn directory 從.svn目錄中刪除未引用的pristines --include-externals : also operate on externals defined by svn:externals properties 還對由svn:externals屬性定義的外部性進行操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --diff3-cmd ARG : deprecated and ignored 被棄用或忽略 Global options: //與上面相同,在此省略
要么從使工作副本處於鎖定狀態的中斷操作中恢復,即遞歸的清理WC中過期的鎖和未完成的操作,要么刪除不需要的文件。
11.copy (cp)
是否訪問庫:是
格式:
copy SRC[@REV]... DST
SRC(源)和DST(目標)都可以是工作拷貝(WC)路徑或URL:
- WC -> WC: 新增內容的復制和時間表(附歷史記錄)
- WC -> URL: 立即將WC的副本提交到URL
- URL -> WC: 檢查到WC的URL,計划添加
- URL -> URL: 完整的服務器端復制;用於分支和標記。⚠️現在SVN只支持同一個倉庫內文件的拷貝,不允許跨倉庫操作。
所有SRCs必須是同一類型的。如果DST是一個現有目錄,則源將作為DST的子目錄添加。復制多個源時,DST必須是一個現有目錄。
⚠️:為了與以前版本的Subversion兼容,使用兩個工作復制路徑(WC -> WC)執行的副本將不會與存儲庫聯系。因此,默認情況下,它們可能無法將合並的跟蹤信息從復制源傳播到目標。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --ignore-externals : ignore externals definitions 忽略外部定義 --parents : make intermediate directories 創建中間目錄 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG --pin-externals : pin externals with no explicit revision to their current revision (recommended when tagging) 對當前修訂號沒有顯式修訂號時標記外部屬性(在標記時推薦) Global options: //與上面相同,在此省略
在工作副本或存儲庫中復制文件和目錄。
svn的分支和標簽用的都是svn copy
舉例:
⚠️copy到url的操作隱含了commit提交動作,所以需要提供log messages
userdeMBP:foo user$ svn cleanup userdeMBP:foo user$ cd .. //下面命令找不到文件的原因好像是因為上面我運行了cleanup,所以這個之前沒有使用過的文件好像就被清理了,雖然我在本地目錄上還是可以看見它,但是它的狀態已經被改變了 userdeMBP:~ user$ svn copy /Users/user/foo/unversioned-1 svn://localhost/myCode/ -m "test copy command" svn: E155010: The node '/Users/user/foo/unversioned-1' was not found.
但原因也有可能是因為該文件是非版本化文件,所以無法找到,我們可以先使用add使其版本化后再看看情況:
userdeMBP:foo user$ svn status ? unversioned-1 //?號表示非版本化
運行add后:
userdeMBP:foo user$ svn add /Users/user/foo/unversioned-1 //將文件版本化 A unversioned-1 userdeMBP:foo user$ svn status //可見狀態已經變化了 A unversioned-1 //然后果然下面的命令就成功了,所以不是運行了cleanup的原因 userdeMBP:foo user$ svn copy /Users/user/foo/unversioned-1 svn://localhost/myCode/ -m "test copy command" Adding copy of unversioned-1 Transmitting file data .done Committing transaction... Committed revision 7.
然后我們就可以使用list查看存儲庫上的狀態:
userdeMBP:foo user$ svn list svn://localhost/myCode/ centos7/ unversioned-1 //可見該文件被成功復制 versioned-1
使用blame也能查看到:
userdeMBP:foo user$ svn blame svn://localhost/myCode/unversioned-1 7 boss don't use add to make this file versioned
這是因為copy到url的操作隱含了commit提交動作
12.delete (del, remove, rm)
是否訪問存儲庫:如果PATH是庫地址時會,是WC則不會
格式:
usage: 1. delete PATH... 2. delete URL...
1. 由PATH路徑指定的每個項都計划在下一次提交時刪除。未提交的文件和目錄將立即從工作副本中刪除,除非給出--keep-local選項。
除非給出--force或--keep-local選項,否則不刪除包含未版本化或修改項的路徑。
2. URL指定的每個項通過立即提交從存儲庫中刪除。
選項:
Valid options: --force : force operation to run 強制操作運行 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG --keep-local : keep path in working copy 保留路徑在工作副本中 Global options: //與上面相同,在此省略
從版本控制中刪除文件和目錄
當操作的是工作副本時,即PATH,svn的delete只是做了個標記,在客戶端獲取新版本時不出現這些被刪除的文件,而文件本身在服務器端仍然是存在的,而且可以通過更新到原來的某個版本找回這些文件
舉例:
1)delete PATH
因為之前我移除了unversioned-1文件,有進行了update,所以導致了一次沖突,但是我沒有解決:
userdeMBP:foo user$ svn up Updating '.': C unversioned-1 At revision 7. Summary of conflicts: Tree conflicts: 1 Searching tree conflict details for 'unversioned-1' in repository: Checking r7... done Tree conflict on 'unversioned-1': A new file appeared during update to r7; it was added by boss in r7. A file scheduled to be added to the repository in the next commit was found in the working copy. Select: (p) Postpone, (r) Mark as resolved, (m) Merge the files, (h) Help, (q) Quit resolution: q Summary of conflicts: Tree conflicts: 1
所以這里運行delete會報錯:
userdeMBP:foo user$ svn delete /Users/user/foo/unversioned-1 svn: E195006: Use --force to override this restriction (local modifications may be lost) svn: E195006: '/Users/user/foo/unversioned-1' has local modifications -- commit or revert them first userdeMBP:foo user$ svn status //狀態說明該文件有沖突C R C unversioned-1 > local file add, incoming file add upon update Summary of conflicts: Tree conflicts: 1
所以打算先進行一下還原revert:
userdeMBP:foo user$ svn revert /Users/user/foo/unversioned-1 Reverted 'unversioned-1' userdeMBP:foo user$ svn list svn://localhost/myCode/ centos7/ versioned-1 userdeMBP:foo user$ svn status //狀態不再顯示有沖突 userdeMBP:foo user$
然后再delete:
userdeMBP:foo user$ svn delete /Users/user/foo/unversioned-1 D unversioned-1
然后本地的unversioned-1文件就被刪除了,相應文件夾中也沒有該文件了。因為它是未提交的文件(這是因為我先執行了delete URL,將其從存儲庫中刪除了),且沒有使用--keep-local,所以會被立即刪除
2)delete URL
userdeMBP:foo user$ svn delete svn://localhost/myCode/unversioned-1 svn: E205007: Could not use external editor to fetch log message; consider setting the $SVN_EDITOR environment variable or using the --message (-m) or --file (-F) options svn: E205007: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found //上面的錯誤的原因是因為我忘記寫注釋了,加上就成功了 userdeMBP:foo user$ svn delete svn://localhost/myCode/unversioned-1 -m "test delete url command" Committing transaction... Committed revision 8. userdeMBP:foo user$ svn list svn://localhost/myCode/ //可見該文件已經從存儲庫中刪除了 centos7/ versioned-1
⚠️copy和delete如果訪問的是存儲庫,其實都隱式地進行了commit操作,所以一定要記得寫注釋
13.diff (di)
是否訪問存儲庫:訪問的是存儲庫路徑時是
格式:
usage: 1. diff 2. diff [-c M | -r N[:M]] [TARGET[@REV]...] 3. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \ [PATH...] 4. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV] 5. diff OLD-URL[@OLDREV] NEW-PATH[@NEWREV] 6. diff OLD-PATH[@OLDREV] NEW-URL[@NEWREV]
1. 只需使用“svn diff”在工作副本中顯示本地修改。
2. 顯示在兩個版本之間的REV中對TARGETs所做的更改。
TARGETs可以是所有工作復制路徑或所有url。
如果TARGETs是工作拷貝路徑,則N默認為BASE, M默認為工作副本;如果是url,必須指定N, M默認為HEAD。
“-c M”選項等價於“-r N:M”,其中N = M-1。
使用“-c -M”做相反的事情(即M為負數):“-r M:N”其中N = M-1。
3.展示在OLDREV中看到的OLD-TGT與NEWREV中看到的NEW-TGT的區別。如果路徑,則與舊tgt和新tgt相關,並將輸出限制為這些路徑的差異。
OLD-TGT和NEW-TGT可以是復制路徑或URL[@REV]。
如果沒有指定,NEW-TGT默認為OLD-TGT。
-r N使OLDREV默認為N, -r N:M使OLDREV默認為N, NEWREV默認為M。
如果沒有指定OLDREV或NEWREV,它們默認為為工作復制目標而工作,並指向URL目標。
舊tgt和新tgt也可以是未版本化目標的路徑。不能為未版本化的目標指定修訂號。
兩個目標必須是相同的節點類型(文件或目錄)。
不支持將未版本化的目標與URL目標進行比較。
4. 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'的簡寫
5. 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-PATH[@NEWREV]'的簡寫
6. 'svn diff --old=OLD-PATH[@OLDREV] --new=NEW-URL[@NEWREV]'的簡寫
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -c [--change] ARG : the change made by revision ARG (like -r ARG-1:ARG) 來自修訂號ARG的更改(如使用-r ARG-1:ARG的效果) If ARG is negative this is like -r ARG:ARG-1 如果ARG為負數,則其效果與-r ARG:ARG-1 相同 If ARG is of the form ARG1-ARG2 then this is like ARG1:ARG2, where ARG1 is inclusive 如果ARG的形式是ARG1-ARG2,那么這就像ARG1:ARG2,其中ARG1是包含的 --old ARG : use ARG as the older target 使用ARG作為更舊的目標 --new ARG : use ARG as the newer target 使用ARG作為更新的目標 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --diff-cmd ARG : use ARG as diff command 使用ARG作為diff命令 --internal-diff : override diff-cmd specified in config file 覆蓋配置文件中指定的diff-cmd -x [--extensions] ARG : Specify differencing options for external diff or internal diff or blame. Default: '-u'. 為外部差異或內部差異或過失指定差異選項。默認值:'-u'。 Options are separated by spaces. Internal diff and blame take: 選項由空格分隔。內部差異和責備采取: -u, --unified: Show 3 lines of unified context 顯示3行統一上下文 -b, --ignore-space-change: Ignore changes in amount of white space 忽略空白數量的更改 -w, --ignore-all-space: Ignore all white space 忽略所有空白 --ignore-eol-style: Ignore changes in EOL style 忽略EOL樣式的更改 -U ARG, --context ARG: Show ARG lines of context 顯示ARG上下文的行 -p, --show-c-function: Show C function name 顯示C函數名 --no-diff-added : do not print differences for added files 不為添加的文件打印差異 --no-diff-deleted : do not print differences for deleted files 不為刪除的文件打印差異 --ignore-properties : ignore properties during the operation 在操作過程中忽視屬性 --properties-only : show only properties during the operation 在操作過程中顯示的唯一屬性 --show-copies-as-adds : don't diff copied or moved files with their source 不區別復制或移動文件和其源文件 --notice-ancestry : diff unrelated nodes as delete and add 在刪除和添加過程中區別不相關節點 --summarize : show a summary of the results 顯示結果的總結 --changelist [--cl] ARG : operate only on members of changelist ARG 只對在更改列表ARG中的成員進行操作 --force : force operation to run 強制運行操作 --xml : output in XML 以XML格式輸出 --git : use git's extended diff format 使用git的擴展diff格式 --patch-compatible : generate diff suitable for generic third-party patch tools; currently the same as --show-copies-as-adds --ignore-properties 生成適用於通用第三方補丁工具的diff;目前和--show-copies-as-adds --ignore-properties標志效果相同
Global options: //與上面相同,在此省略
舉例:
userdeMBP:foo user$ svn diff //說明最近一次更改了unversioned-1文件 Index: unversioned-1 =================================================================== --- unversioned-1 (revision 7) //意思是-表示修訂版本為7時的修改,即添加該文件 +++ unversioned-1 (nonexistent) //+表示的是delete的修改 @@ -1 +0,0 @@ //修訂版本為7的修改在第一行,delete的修改沒有在哪一行 -don't use add to make this file versioned //修訂版本為7即添加了這一句話 \ No newline at end of file
比較存儲庫中svn://localhost/myCode/centos7/Vagrantfile文件在修訂版本3和4的不同點:
userdeMBP:foo user$ svn diff -r 3:4 svn://localhost/myCode/centos7/Vagrantfile Index: Vagrantfile =================================================================== --- Vagrantfile (revision 3) +++ Vagrantfile (revision 4) @@ -17,13 +17,13 @@ //說明兩個版本的不同在於17,13行 # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false //版本3時 + config.vm.box_check_update = false //版本4時 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port - # config.vm.network "forwarded_port", guest: 80, host: 8080 + config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access
使用參數 --summarize --xml,對結果進行總結並以XML格式顯示出來:
userdeMBP:foo user$ svn diff -r 3:4 --xml svn://localhost/myCode/centos7/Vagrantfile //注意,--xml一定要和--summarize參數一起使用 svn: E205000: Try 'svn help diff' for more information svn: E205000: '--xml' option only valid with '--summarize' option userdeMBP:foo user$ svn diff -r 3:4 --summarize svn://localhost/myCode/centos7/Vagrantfile //但是--summarize可以自己使用,說明該文件在兩個版本中有修改 M svn://localhost/myCode/centos7/Vagrantfile userdeMBP:foo user$ svn diff -r 3:4 --summarize --xml svn://localhost/myCode/centos7/Vagrantfile <?xml version="1.0" encoding="UTF-8"?> <diff> <paths> <path props="none" kind="file" item="modified">svn://localhost/myCode/centos7/Vagrantfile</path> </paths> </diff>
14.export
是否訪問庫:如果訪問的是URL則會
格式:
usage: 1. export [-r REV] URL[@PEGREV] [PATH] 2. export [-r REV] PATH1[@PEGREV] [PATH2]
1. 將一個干凈的目錄樹從URL指定的存儲庫中導出到PATH中,如果指定則得到在修訂號REV時的數據,否則則得到在HEAD的數據。
如果省略PATH,則URL的最后一個組件用於本地目錄名。
2. 從PATH1指定的工作副本中導出一個干凈的目錄樹,如果指定則得到在修訂號REV時的數據,否則則得到正在工作的數據。
如果省略PATH2,則PATH1的最后一個組件用於本地目錄名。如果未指定REV,則保留所有本地更改。
不受版本控制的文件將不會被復制。
如果指定,PEGREV將確定首先查找目標的修訂版本。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --force : force operation to run 強制操作運行 --native-eol ARG : use a different EOL marker than the standard system marker for files with the svn:eol-style property set to 'native'. 對於svn:eol-style 屬性設置為“native”的文件,使用與標准系統標記不同的EOL標記。 ARG may be one of 'LF', 'CR', 'CRLF' ARG可以是'LF', 'CR', 'CRLF'中的一個 --ignore-externals : ignore externals definitions 忽略外部屬性定義 --ignore-keywords : don't expand keywords 不擴展關鍵詞 Global options: //與上面相同,在此省略
舉例:
userdeMBP:foo user$ svn export svn://localhost/myCode/centos7/Vagrantfile /Users/user/export-file A /Users/user/export-file/Vagrantfile Export complete.
然后我們可以看見,本地/Users/user/export-file目錄中果然生成了一個Vagrantfile文件:
15.info
是否會訪問存儲庫:當訪問的是存儲庫路徑時是
格式:
info [TARGET[@REV]...]
打印與每個TARGET相關的信息(默認值:'.')。
TARGET可以是工作復制路徑,也可以是URL。如果指定,REV決定在哪個修訂號版本中首先查找目標;默認值是指向URL或指向WC路徑的BASE。
使用—-show-item,只打印關於目標的一項信息的值。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -R [--recursive] : descend recursively, same as --depth=infinity --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 --incremental : give output suitable for concatenation --xml : output in XML --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG的成員進行操作 --include-externals : also operate on externals defined by svn:externals properties 只對通過svn:externals屬性定義的外部屬性進行操作 --show-item ARG : print only the item identified by ARG: 只打印被ARG標識的項目 'kind' node kind of TARGET TARGET的節點類型 'url' URL of TARGET in the repository 存儲庫中TARGET的URL 'relative-url' repository-relative URL of TARGET TARGET的相對於存儲庫的URL 'repos-root-url' root URL of repository 存儲庫的根URL 'repos-uuid' UUID of repository 存儲庫的UUID 'revision' specified or implied revision 指定或隱含的修訂號 'last-changed-revision' last change of TARGET at or before 'revision' TARGET的上一次或在'revision'中指定的修訂號前的更改 'last-changed-date' date of 'last-changed-revision' 'last-changed-revision'的日期 'last-changed-author' author of 'last-changed-revision' 'last-changed-revision'的作者 'wc-root' root of TARGET's working copy TARGET的工作副本的根 --no-newline : do not output the trailing newline 不輸出尾部換行符 Global options: //與上面相同,在此省略
舉例:
userdeMBP:foo user$ svn info svn://localhost/myCode/centos7 Path: centos7 URL: svn://localhost/myCode/centos7 Relative URL: ^/myCode/centos7 Repository Root: svn://localhost Repository UUID: ae9a497d-2918-4b99-b372-515fac365743 Revision: 8 Node Kind: directory Last Changed Author: boss Last Changed Rev: 6 Last Changed Date: 2019-01-07 14:20:21 +0800 (一, 07 1 2019) userdeMBP:foo user$ svn info --xml svn://localhost/myCode/centos7 //xml格式輸出 <?xml version="1.0" encoding="UTF-8"?> <info> <entry kind="dir" path="centos7" revision="8"> <url>svn://localhost/myCode/centos7</url> <relative-url>^/myCode/centos7</relative-url> <repository> <root>svn://localhost</root> <uuid>ae9a497d-2918-4b99-b372-515fac365743</uuid> </repository> <commit revision="6"> <author>boss</author> <date>2019-01-07T06:20:21.978210Z</date> </commit> </entry> </info>
16.list (ls)
是否訪問存儲庫:如果訪問的是存儲庫地址時是
格式:
list [TARGET[@REV]...]
列出存儲庫中存在的每個TARGET文件和每個目標目錄的內容。如果TARGET是一個工作復制路徑,將使用相應的存儲庫URL。如果指定,REV將用於確定首先查找目標的修訂版本。
默認目標是'.',表示當前工作目錄的存儲庫URL。
可以指定多個--search模式,並將輸出縮減為這些路徑的最后一個段-如文件或目錄名稱-至少匹配其中一個模式。
使用--verbose,每個條目將顯示以下字段:
- 最后一次提交的修訂號
- 最后一次提交的作者
- 如果鎖上了,字母“O”。(使用“svn info URL”查看詳細信息)
- 大小(以字節為單位)
- 最后一次提交的日期和時間
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -v [--verbose] : print extra information 打印額外信息 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity的效果相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --incremental : give output suitable for concatenation 給出適合串聯的輸出 --xml : output in XML 以XML格式輸出 --include-externals : also operate on externals defined by svn:externals properties 只對通過svn:externals屬性定義的外部屬性進行操作 --search ARG : use ARG as search pattern (glob syntax, case-and accent-insensitive, may require quotation marks to prevent shell expansion) 使用ARG作為搜索模式(glob語法不區分大小寫和口音,可能需要引號來防止shell擴展) Global options: //與上面相同,在此省略
顯示目標下的文件和目錄列表
舉例:
userdeMBP:foo user$ svn list svn://localhost/myCode/ centos7/ versioned-1
17.lock
是否訪問存儲庫:是
格式:
lock TARGET...
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -m [--message] ARG : specify lock comment ARG 指定日志信息(即注釋) -F [--file] ARG : read lock comment from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of lock comment source 強制日志消息源的有效性 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --force : steal locks 偷鎖 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 Global options: //與上面相同,在此省略
對目標獲得修改鎖。如果目標已被其他用戶鎖定,則會拋出警告信息。使用--force強制從其他用戶或工作副本竊取鎖
舉例:
userdeMBP:foo user$ svn lock svn://localhost/myCode/versioned-1 //上鎖 'svn://localhost/myCode/versioned-1' locked by user 'boss'.
然后當其他用戶想要對其上鎖時:
userdeMBP:foo user$ svn lock svn://localhost/myCode/versioned-1 --username=guest --password=00001 svn: warning: W160035: Path '/myCode/versioned-1' is already locked by user 'boss' in filesystem 'ae9a497d-2918-4b99-b372-515fac365743' svn: E200009: One or more locks could not be obtained //需要使用--force才能成功 userdeMBP:foo user$ svn lock svn://localhost/myCode/versioned-1 --username=guest --password=00001 --force 'svn://localhost/myCode/versioned-1' locked by user 'guest'.
18.log
是否訪問存儲庫:是
格式:
1. log [PATH][@REV] 2. log URL[@REV] [PATH...]
1. 打印PATH對應的URL的日志消息(默認值:'.')。
如果指定,REV是第一次查找URL的修訂版本,默認的修訂范圍是REV:1。
如果沒有指定REV,默認的修訂范圍是BASE:1,因為URL可能不存在於HEAD修訂號中。
2. 打印URL下PATHs(默認值:'.')的日志消息。
如果指定,REV是第一次查找URL的版本,默認的版本范圍是REV:1;否則,URL將在HEAD中查找,默認的修訂范圍是HEAD:1。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -c [--change] ARG : the change made in revision ARG 在修訂號ARG上的更改 -q [--quiet] : do not print the log message 不輸出日志信息 -v [--verbose] : also print all affected paths 也打印所有受影響的路徑 -g [--use-merge-history] : use/display additional information from merge history 使用或顯示來自合並歷史中的額外信息 --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 --stop-on-copy : do not cross copies while traversing history 穿越歷史時不要交叉拷貝 --incremental : give output suitable for concatenation 給出適合串聯的輸出 --xml : output in XML 以XML格式輸出 -l [--limit] ARG : maximum number of log entries 日志條目的最大數量 --with-all-revprops : retrieve all revision properties 檢索所有的修訂號屬性 --with-no-revprops : retrieve no revision properties 不檢索修訂號屬性 --with-revprop ARG : retrieve revision property ARG 檢索指定的修訂號屬性 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --diff : produce diff output 生成diff輸出 --diff-cmd ARG : use ARG as diff command 使用ARG作為diff命令 --internal-diff : override diff-cmd specified in config file 覆蓋配置文件中指定的diff-cmd -x [--extensions] ARG : Specify differencing options for external diff or internal diff or blame. Default: '-u'. 為外部差異或內部差異或過失指定差異選項。默認值:'-u'。 Options are separated by spaces. Internal diff and blame take: 選項由空格分隔。內部差異和責備采取: -u, --unified: Show 3 lines of unified context 顯示3行統一上下文 -b, --ignore-space-change: Ignore changes in amount of white space 忽略空白數量的更改 -w, --ignore-all-space: Ignore all white space 忽略所有空白 --ignore-eol-style: Ignore changes in EOL style 忽略EOL樣式的更改 -U ARG, --context ARG: Show ARG lines of context 顯示ARG上下文的行 -p, --show-c-function: Show C function name 顯示C函數名 --search ARG : use ARG as search pattern (glob syntax, case-and accent-insensitive, may require quotation marks to prevent shell expansion) 使用ARG作為搜索模式(glob語法不區分大小寫和口音,可能需要引號來防止shell擴展) --search-and ARG : combine ARG with the previous search pattern 將ARG與前面的搜索模式結合起來 Global options: //與上面相同,在此省略
顯示一組指定修訂版本號和/或路徑的日志消息
可以指定多個“-c”或“-r”選項(但不是“-c”和“-r”選項的組合),並且允許混合正向和反向范圍。
使用-v,還可以為每個日志消息打印所有受影響的路徑。
每一個變化的路徑前面都有一個符號描述變化:
A:路徑被添加或復制。
D:路徑被刪除了。
R:路徑被替換(刪除並在同一版本中重新添加)。
M:修改了路徑文件和/或屬性內容。
如果從其他地方復制了添加的或替換的路徑,則復制源路徑和修訂號將顯示在圓括號中。
如果一個文件或目錄通過“svn move”從一個路徑移動到另一個路徑,那么舊路徑將被列出為已刪除,而新路徑將被列出為在之前的修訂中從舊路徑復制的路徑。
對於-q,不要打印日志消息主體本身(注意這與-v兼容)。
每個日志消息只打印一次,即使顯式請求修改的受影響路徑不止一條。默認情況下,日志遵循復制歷史記錄。
使用--stop-on-copy禁用此行為,這對於確定分支點非常有用。
--depth選項僅與--diff選項組合有效,並將顯示的diff的范圍限制為指定的深度。
如果使用—-search選項,則僅當所提供的搜索模式與作者、日期、日志消息文本(除非使用—-quiet)匹配時,才顯示日志消息;如果還提供-—verbose選項,則顯示更改的路徑。
模式是區分大小寫匹配的,可能包含glob通配符:
? 匹配任何單個字符
* 匹配任意字符序列
[abc] 匹配括號中列出的任何字符
如果提供了多個--search選項,如果日志消息與提供的任何搜索模式匹配,那么將顯示日志消息。
如果使用--search-and選項,則該選項的參數與前面的--search或--search-and選項的模式相結合,並且只有與組合搜索模式匹配時才顯示日志消息。
如果—-limit與—-search結合使用,—-limit將限制搜索的日志消息的數量,而不是將輸出限制為匹配的日志消息的特定數量。
例子:
顯示當前工作副本目錄的最新5條日志消息,並顯示每次提交中更改的路徑:
userdeMBP:foo user$ svn log -l 5 -v ------------------------------------------------------------------------ r7 | boss | 2019-01-07 15:00:56 +0800 (一, 07 1 2019) | 1 line Changed paths: A /myCode/unversioned-1 test copy command ------------------------------------------------------------------------ r6 | boss | 2019-01-07 14:20:21 +0800 (一, 07 1 2019) | 1 line Changed paths: M /myCode/centos7/Vagrantfile M /myCode/versioned-1 centos7_file group file ------------------------------------------------------------------------ r5 | boss | 2019-01-07 10:14:12 +0800 (一, 07 1 2019) | 1 line Changed paths: A /myCode/versioned-1 查看add的使用效果add了versioned-1文件 ------------------------------------------------------------------------ r4 | boss | 2019-01-04 18:04:45 +0800 (五, 04 1 2019) | 1 line Changed paths: M /myCode/centos7/Vagrantfile 修改了Vagrantfile文件的config.vm.network配置項之前錯了 ------------------------------------------------------------------------ r3 | boss | 2019-01-04 18:02:12 +0800 (五, 04 1 2019) | 1 line Changed paths: M /myCode/centos7/Vagrantfile 修改了Vagrantfile文件的config.vm.network配置項 ------------------------------------------------------------------------
顯示Vagrantfile截至第3修訂版本號的日志,從3開始遞歸到1:
userdeMBP:foo user$ svn log ./centos7/Vagrantfile@3 ------------------------------------------------------------------------ r3 | boss | 2019-01-04 18:02:12 +0800 (五, 04 1 2019) | 1 line 修改了Vagrantfile文件的config.vm.network配置項 ------------------------------------------------------------------------ r2 | boss | 2019-01-04 16:18:10 +0800 (五, 04 1 2019) | 1 line 修改了Vagrantfile文件的config.vm.box_check_update配置項 ------------------------------------------------------------------------ r1 | boss | 2019-01-04 16:03:49 +0800 (五, 04 1 2019) | 1 line 初始化導入centos7的vagrantfile文件 ------------------------------------------------------------------------
顯示每個提交到versioned-1的日志消息和差異:
userdeMBP:foo user$ svn log --diff svn://localhost/myCode/versioned-1 ------------------------------------------------------------------------ r6 | boss | 2019-01-07 14:20:21 +0800 (一, 07 1 2019) | 1 line centos7_file group file Index: versioned-1 =================================================================== --- versioned-1 (revision 5) +++ versioned-1 (revision 6) @@ -1 +1,2 @@ -use add command to make this file versioned \ No newline at end of file +use add command to make this file versioned +and now test changelist \ No newline at end of file ------------------------------------------------------------------------ r5 | boss | 2019-01-07 10:14:12 +0800 (一, 07 1 2019) | 1 line 查看add的使用效果add了versioned-1文件 Index: versioned-1 =================================================================== --- versioned-1 (nonexistent) +++ versioned-1 (revision 5) @@ -0,0 +1 @@ +use add command to make this file versioned \ No newline at end of file ------------------------------------------------------------------------
(因為上面的命令使用完整的URL,所以不需要工作副本)。
下面的方法沒有本地測試
顯示子 foo.c和的 bar.c的目錄 '/trunk' 出現在50修訂版本號的日志消息,使用^ / URL快捷方式:
svn log ^/trunk@50 foo.c bar.c
顯示foo.c在下一次'svn update'期間的任何傳入更改的日志消息:
svn log -r BASE:HEAD foo.c
顯示在/branches/foo中創建的修訂版本的日志消息:
svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/foo
如果在22修訂版本號中^/trunk/foo.c移到了^/trunk/bar.c'中,'svn log -v' 將顯示在其更改路徑列表中的刪除和復制,如:
D /trunk/foo.c A /trunk/bar.c (from /trunk/foo.c:21)
19.merge
是否訪問存儲庫:當訪問庫地址時是
格式:
1. merge SOURCE[@REV] [TARGET_WCPATH] (the 'complete' merge) 2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH] (the 'cherry-pick' merge) 3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH] (the '2-URL' merge)
作用其實就是合並兩個受控源的不同之處,存放到一個WC里
1. 此表單只有一個源路徑,沒有修訂范圍,稱為“完全”合並:
svn merge SOURCE[@REV] [TARGET_WCPATH]
完整的合並用於下面描述的“功能分支”模式中的“同步”和“重新集成”合並。它查找源分支上尚未合並到目標分支的所有更改,並將它們合並到工作副本中。合並跟蹤用於了解哪些更改已經合並。
SOURCE指定將從何處提取更改的分支,TARGET_WCPATH指定目標分支的工作副本到提供的更改處。通常SOURCE和TARGET_WCPATH應該分別對應於一個分支的根。如果你只想合並一個子樹,那么使用TARGET_WCPATH;但是這是不鼓勵的,以避免子樹合並信息。)
SOURCE通常是一個URL。可選的“@REV”指定URL的peg版本和考慮合並的最新版本;如果沒有指定REV,則假定HEAD修訂版本。如果SOURCE是一個工作復制路徑,則使用該路徑的對應URL,而'REV'的默認值是基本修訂版本(通常是最后更新到的修訂)。
TARGET_WCPATH是一個工作復制路徑;如果省略了,通常假設為'.'。但會有一些特殊情況:
-如果來源是URL:
-如果URL的basename和'.'的basename是相同的,那么差異就適用於'.'。否則,如果在'.'中找到與URL具有相同basename的文件,就將差異應用於該文件。在所有其他情況下,目標默認為'.'。
-如果源文件是工作拷貝路徑:
-如果源文件是一個文件,則差異將應用於該文件(對反向合並的早期更改有用)。否則,如果源是一個目錄,那么目標的默認值是'.'。
在正常使用中,在一個修訂版本中的工作副本應該是最新的,沒有局部修改和切換的子樹。
-“功能分支”合並模式-
在這個常用的工作流中,也稱為“開發分支”模式,開發人員創建一個分支並提交一系列實現新特性的更改。開發人員定期合並來自parent分支的所有最新更改,以便使開發分支與這些更改保持同步。當feature完成時,開發人員執行從feature分支到parent分支的合並,以重新集成更改。
從parent分支到feature分支的合並稱為“同步”或“追趕”合並,從feature分支到parent分支的合並稱為“重新集成”合並。
- 同步合並例子 ,從parent分支到feature分支-
Subversion將定位'trunk'上尚未合並到'feature'分支中的所有更改。在這種情況下,這是一個單一的范圍,r100:200。在上圖中,L標記合並源的左側(trunk@100), R標記合並源的右側(trunk@200)。L和R之間的差異將應用於目標工作復制路徑。在這種情況下,工作副本是整個'feature'分支的干凈簽出。
要執行此同步合並,請獲得feature分支的一個干凈的工作副本,並在其頂級目錄中運行以下命令:
svn merge ^/trunk
注意,合並現在只在本地工作副本中,仍然需要提交到存儲庫中,以便其他人可以看到它。你可以查看更改,並且可能必須在提交合並之前解決沖突。
- 重新合並例子 ,從feature分支到parent分支-
feature分支最后一次與trunk同步是在修訂x之前。所以trunk@X和feature@HEAD之間的差異包含了實現feature的完整更改集,沒有其他更改。這些更改應用於主干。
在上面的圖中,L標記了合並的左側(trunk@X), R標記了右側(feature@HEAD)。左右兩邊的不同合並到目標trunk中。
要執行合並,需要一個干凈的trunk工作副本,並在其頂級目錄中運行以下命令:
svn merge ^/feature
為了防止不必要的合並沖突,重新集成合並要求TARGET_WCPATH不是混合修訂版本的工作副本,沒有本地修改,也沒有交換的子樹。
重新集成合並還要求源分支與目標同步——在上面的示例中,這意味着分支點W和上一個合並的修訂版本X之間的所有修訂版本都被合並到feature分支中,因此中間沒有未合並的修訂版本。
2. 這種形式被稱為'cherry-pick'合並:
svn merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]
cherry-pick合並用於合並從一個分支到另一個分支的特定修訂(或修訂范圍。默認情況下,它使用合並跟蹤來自動跳過已經合並到目標中的任何修訂;你可以使用--ignore-ancestry選項來禁用這種跳過。
SOURCE通常是一個URL。可選的“@REV”只指定URL的peg版本,不影響合並范圍;如果沒有指定REV,則假定HEAD修訂版本。如果SOURCE是一個工作復制路徑,則使用該路徑的對應URL,而'REV'的默認值是基本修訂(通常是最后更新到的修訂)。
TARGET_WCPATH是一個工作復制路徑;如果省略了,通常是假設為'.'。'complete'合並表單中提到的特殊情況也適用於此。
合並的修訂范圍由“-r”和/或“-c”選項指定。“-r N:M”是指修訂N和M在源分支歷史上的差異。你可以使用“-c M”合並單個修訂:“-c M”等價於“-r :M”。每個這樣的差異都應用於TARGET_WCPATH。
如果TARGET_WCPATH中的合並信息指示范圍內的修訂已經合並,則不會再次合並這些修訂中所做的更改。如果需要,將范圍分解為多個子范圍,並分別合並每個子范圍。
“反向范圍”可用於撤消更改。例如,當源和目標引用相同的分支時,先前提交的修訂可以“撤消”。在相反的范圍內,“-r N:M”中的N大於M,或者“-c”選項與負數一起使用:“-c -M”等價於“-r M:”。取消這樣的更改也稱為執行“反向合並”。
可以指定多個“-c”和/或“-r”選項,允許混合正向和反向范圍。
-選擇合並的例子-
修訂版本號50中主干上修正了一個bug。這個修復需要從trunk合並到release分支:
在上面的圖中,L標記合並的左側(trunk@49), R標記合並的右側(trunk@50)。左側和右側之間的差異應用於目標工作復制路徑。
請注意,修訂版本號49和50之間的差異正是在修訂版本號50中提交的更改,不包括在修訂49中提交的更改。
要執行合並,請獲得release分支的一個干凈的工作副本,並在其頂級目錄中運行以下命令;記住,默認目標是'.':
svn merge -c50 ^/trunk
你也可以cherry-pick幾個修訂版本號和/或修訂范圍:
svn merge -c50,54,60 -r65:68 ^/trunk
3.這種形式稱為'2-URL merge':
svn merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]
只有當其他變量不適合你的情況時,才應該使用此合並變量,因為要掌握此變量可能相當復雜。
指定兩個源url,標識同一分支上的兩個樹或不同分支上的兩個樹。比較樹,並將SOURCE1@REV1和SOURCE2@REV2之間的差異應用於TARGET_WCPATH上的目標分支的工作副本。目標分支可能與一個或兩個源相同,也可能不同。所涉及的三個分支可能完全無關。
TARGET_WCPATH是一個工作復制路徑;如果省略了,通常是假設為'.'。'complete'合並表單中提到的特殊情況也適用於此。
還可以將SOURCE1和/或SOURCE2指定為工作復制路徑,在這種情況下,合並源URL派生自工作復制。
- 2-URL合並例子 -
在“foo”和“bar”這兩個獨立的分支上開發了兩個特性。現在已經很清楚,在重新集成之前,“bar”應該與“foo”分支結合以進行進一步的開發。
盡管這兩個特性分支都起源於主干,但它們並不是直接相關的——一個不是另一個的直接副本。2-URL合並是必要的。
“bar”分支已與主干同步到修訂500。(如果不知道此修訂號,可以使用“svn log”和/或“svn mergeinfo”命令。)trunk@500和bar@HEAD之間的差異包含與特性“bar”相關的完整更改集,沒有其他更改。這些更改應用於“foo”分支。
在上面的圖中,L標記了合並的左側(trunk@500), R標記了右側(bar@HEAD)。左側和右側之間的差異應用於目標工作復制路徑,在本例中是“foo”分支的工作復制。
要執行合並,要有一個干凈的“foo”分支的工作副本,並在其頂級目錄中運行以下命令:
svn merge ^/trunk@500 ^/bar
可以使用svn的diff命令預覽2-URL合並所應用的確切更改,如果你沒有可以合並到的干凈工作副本,那么驗證一下這一點是個好主意。在這種情況下:
svn diff ^/trunk@500 ^/bar@HEAD
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -c [--change] ARG : the change made by revision ARG (like -r ARG-1:ARG) 來自修訂號ARG的更改(如使用-r ARG-1:ARG的效果) If ARG is negative this is like -r ARG:ARG-1 如果ARG為負數,則其效果與-r ARG:ARG-1 相同 If ARG is of the form ARG1-ARG2 then this is like ARG1:ARG2, where ARG1 is inclusive 如果ARG的形式是ARG1-ARG2,那么這就像ARG1:ARG2,其中ARG1是包含的 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --force : force deletions even if deleted contents don't match 即使刪除內容不匹配也強制刪除 --dry-run : try operation but make no changes 嘗試操作但不造成更改 --diff3-cmd ARG : use ARG as merge command 使用ARG作為合並命令 --record-only : merge only mergeinfo differences 只有在合並信息不同時才合並 -x [--extensions] ARG : Specify differencing options for external diff or internal diff or blame. Default: '-u'. 為外部差異或內部差異或過失指定差異選項。默認值:'-u'。 Options are separated by spaces. Internal diff and blame take: 選項由空格分隔。內部差異和責備采取: -u, --unified: Show 3 lines of unified context 顯示3行統一上下文 -b, --ignore-space-change: Ignore changes in amount of white space 忽略空白數量的更改 -w, --ignore-all-space: Ignore all white space 忽略所有空白 --ignore-eol-style: Ignore changes in EOL style 忽略EOL樣式的更改 -U ARG, --context ARG: Show ARG lines of context 顯示ARG上下文的行 -p, --show-c-function: Show C function name 顯示C函數名 --ignore-ancestry : disable merge tracking; diff nodes as if related 禁用合並追蹤;diff節點好像相關 --accept ARG : specify automatic conflict resolution action 指定自動沖突解決操作 ('postpone', 'working', 'base', 'mine-conflict','theirs-conflict', 'mine-full', 'theirs-full', 'edit', 'launch', 'recommended') (shorthand:'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l', 'r') 對應的縮寫 --reintegrate : deprecated 棄用 --allow-mixed-revisions : Allow operation on mixed-revision working copy. 允許在混合修訂版本號的工作副本中的操作 Use of this option is not recommended! 這個選項不推薦使用 Please run 'svn update' instead. 請運行'svn update'命令來代替它 -v [--verbose] : print extra information 打印額外信息 Global options: //與上面相同,在此省略
將更改合並到工作副本中
對於每個合並的項,將打印一行,其中包含報告所采取的操作的字符。這些字的意思如下:
- A Added 添加
- D Deleted 刪除
- U Updated 更新
- C Conflict 有沖突
- G Merged 合並
- E Existed 已存在
- R Replaced 替換
第一列中的字符報告關於項本身的內容。
第二列中的字符報告項的屬性。
第三列中的“C”表示樹沖突,而第一列和第二列中的“C”分別表示文件和屬性值中的文本沖突。
-合並跟蹤-
Subversion使用svn:mergeinfo屬性來跟蹤合並歷史。此屬性在合並開始時考慮以確定要合並什么,並在合並結束時更新以描述發生的合並。Mergeinfo僅在兩個源位於同一歷史行時使用——如果第一個源是第二個源的祖先,或者相反(例如,如果一個源最初是通過復制另一個源創建的)。這在使用同步合並和重新集成合並時得到驗證和執行。
--ignore-ancestry 選項可以防止合並跟蹤來忽略mergeinfo,既不考慮它,也不記錄它。
-從外部存儲庫合並-
Subversion確實支持從外部存儲庫進行合並。雖然所有合並源url必須指向相同的存儲庫,但是合並目標工作副本可能來自與源不同的存儲庫。
然而,也有一些警告。最值得注意的是,合並源中創建的副本將轉換為合並目標中的普通添加。此外,對於來自外部存儲庫的合並,不支持合並跟蹤。
20.mergeinfo
格式:
1. mergeinfo SOURCE[@REV] [TARGET[@REV]] 2. mergeinfo --show-revs=WHICH SOURCE[@REV] [TARGET[@REV]]
1. 總結SOURCE和TARGET之間合並的歷史。如圖所示,從左到右:
- 樹枝最年輕的共同祖先;
- 兩個方向上的最新完整合並,以及將用於下一個完整合並的公共基;
- 每個分支頂端的存儲庫路徑和修訂號。
2. 在已合並到TARGET(使用-—show-revs=merge)或未合並到SOURCE(使用—-show-revs= qualified)的SOURCE上打印修訂號。只打印SOURCE中至少有一個更改的修訂。
如果提供--revision(-r),則篩選顯示的信息,以僅顯示與指定范圍內的修訂版本號相關的信息。修訂號、日期和'HEAD'關鍵字是有效的范圍值。
SOURCE和TARGET分別是源和目標分支url。(如果給定WC路徑,則使用相應的基URL)。默認TARGET是當前工作目錄('.')。REV指定要視為分支頂端的修訂版本號;SOURCE的默認值是HEAD,TARGET的默認值是URL的HEAD或WC路徑的BASE。
深度可以是'empty'或'infinity';默認值是'empty'。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -v [--verbose] : print extra information 打印額外信息 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --show-revs ARG : specify which collection of revisions to display('merged', 'eligible') 指定要顯示的修訂集合('merged', 'eligible') --log : show revision log message, author and date 顯示修訂的日志信息、作者和日期 --incremental : give output suitable for concatenation 給出適合串聯的輸出 Global options: //與上面相同,在此省略
顯示合並相關信息
21.mkdir
是否訪問存儲庫:當訪問庫地址時是
格式:
1. mkdir PATH... 2. mkdir URL...
創建版本控制目錄。
1. 由工作復制PATH指定的每個目錄都在本地創建,並計划在下一次提交時添加。
2. URL指定的每個目錄都是通過立即提交在存儲庫中創建的。
在這兩種情況下,所有中間目錄都必須已經存在,除非給出--parent選項。
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --parents : make intermediate directories 創建中間目錄 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor-cmd 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG Global options: //與上面相同,在此省略
在版本控制下創建新目錄
舉例:
1)PATH
userdeMBP:foo user$ svn mkdir /Users/user/foo/newdir
A newdir
2)URL,隱式運行了commit提交命令,所以需要-m
userdeMBP:foo user$ svn list svn://localhost/myCode 查看運行前 centos7/ versioned-1 userdeMBP:foo user$ svn mkdir svn://localhost/myCode/newdir -m "test midir URL command" Committing transaction... Committed revision 9. userdeMBP:foo user$ svn list svn://localhost/myCode //運行后果然生成了一個新目錄 centos7/ newdir/ versioned-1
22.move (mv, rename, ren)
是否訪問存儲庫:當訪問庫地址時是
格式:
move SRC... DST
SRC和DST都可以是工作拷貝(WC)路徑或url:
WC -> WC:移動工作副本中的項目,作為稍后提交的本地更改(帶或不帶進一步更改)
URL -> URL:直接在存儲庫中移動一個項目,立即在存儲庫中創建一個新的修訂
所有SRCs必須是同一類型的。如果DST是一個現有目錄,則源將作為DST的子目錄添加。在移動多個源時,DST必須是一個現有目錄。
WC -> WC移動的SRC和DST必須在同一個版本中提交。
此外,WC -> WC移動將拒絕移動混合修訂子樹。
為了避免不必要的沖突,建議在移動子樹之前運行“svn update”將其更新為單個修訂。
允許混合修訂選項用於向后兼容性。
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --force : force operation to run 強制運行操作 --parents : make intermediate directories 創建中間目錄 --allow-mixed-revisions : Allow operation on mixed-revision working copy. 允許在混合修訂版本號的工作副本中的操作 Use of this option is not recommended! 這個選項不推薦使用 Please run 'svn update' instead. 請運行'svn update'命令來代替它 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor-cmd 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG -r [--revision] ARG : deprecated and ignored 棄用並忽略 Global options: //與上面相同,在此省略
在工作副本或存儲庫中移動(重命名)項目
舉例:
將versioned-1改名為versioned-2:
userdeMBP:foo user$ svn move versioned-1 versioned-2 A versioned-2 D versioned-1
23.patch
格式:
patch PATCHFILE [WCPATH]
將PATCHFILE中的unidiff補丁應用於工作拷貝WCPATH。
如果忽略WCPATH,則假設其值為'.'。
可以使用“svn diff”命令或第三方擴散工具生成適用於工作副本的unidiff補丁。
除了“svn diff”生成的Subversion屬性差異外,PATCHFILE的任何非unidiff內容都將被忽略。
補丁中列出的更改將被應用或拒絕。
如果某個更改在其准確的行偏移量上不匹配,那么如果在其他地方發現與補丁提供的上下文行匹配,則可以在文件中更早或更晚地應用該更改。
還可以使用fuzz應用更改,這意味着在匹配更改時將忽略一行或多行上下文。
如果無法為更改找到匹配的上下文,則更改會發生沖突,並將其寫入擴展名為.svnpatch.rej的拒絕文件。
對於每個打補丁的文件,將打印一行,其中包含報告所采取的操作的字符。這些字的意思如下:
A Added 添加
D Deleted 刪除
U Updated 更新
C Conflict 沖突
G Merged (with local uncommitted changes) 合並(帶着本地未呈遞的更改)
在以“>”符號開頭的行上報告應用偏移量或模糊的更改。你應該仔細檢查這些更改。
如果補丁從一個文件中刪除所有內容,則該文件將被計划刪除。如果補丁創建了一個新文件,該文件將被調度為添加。使用'svn revert'撤消你不同意的刪除和添加。
提示:如果補丁文件是用Subversion創建的,那么它將包含補丁將干凈地應用到的修訂N的數量(查找類似'--- foo/bar.txt(revision N)'這樣的行)。
為了避免拒絕,首先使用“svn update -r N”更新到修訂N,應用補丁,然后更新到HEAD修訂。這樣,沖突就可以交互式地解決。
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --dry-run : try operation but make no changes 嘗試操作但不造成更改 --strip ARG : number of leading path components to strip from paths parsed from the patch file. 要從從補丁文件解析的路徑中剝離的主要路徑組件的數量 --strip 0 is the default and leaves paths unmodified. 默認值,路徑未修改 --strip 1 would change the path 'doc/fudge/crunchy.html' to 'fudge/crunchy.html'. 將將'doc/fudge/crunchy.html'路徑改變為'fudge/crunchy.html' --strip 2 would leave just 'crunchy.html' 只留下'crunchy.html' The expected component separator is '/' on all platforms. A leading '/' counts as one component. 預期的組件分隔符在所有平台上都是'/'。前導'/'是一個組成部分。 --reverse-diff : apply the unidiff in reverse 反過來應用unidiff --ignore-whitespace : ignore whitespace during pattern matching 在模式匹配期間忽略空格 Global options: //與上面相同,在此省略
對工作副本應用補丁
24.propdel (pdel, pd)
是否訪問存儲庫:當訪問庫地址時是
格式:
1. propdel PROPNAME [PATH...] 2. propdel PROPNAME --revprop -r REV [TARGET]
1. 刪除工作副本中的版本化屬性。
2. 刪除repos修訂版本中的未版本化的遠程屬性。
TARGET只確定要訪問哪個存儲庫。
有關svn:*特殊屬性的描述,請參見“svn help propset”。
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 --revprop : operate on a revision property (use with -r) 在修訂版本號屬性中操作(使用-r) --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG成員進行操作 Global options: //與上面相同,在此省略
從文件、目錄或修訂中刪除屬性
舉例:
svn propdel svn:mime-type someFile //從someFile上移除svn:mime-type這個屬性
25.propedit (pedit, pe)
是否訪問存儲庫:當訪問庫地址時是
格式:
1. propedit PROPNAME TARGET... 2. propedit PROPNAME --revprop -r REV [TARGET]
1. 在工作副本或存儲庫中編輯版本化的屬性。
2. 在repos修訂版本中編輯未版本的遠程屬性。
TARGET只確定要訪問哪個存儲庫。
有關svn:*特殊屬性的描述,請參見“svn help propset”。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 --revprop : operate on a revision property (use with -r) 在修訂版本號屬性中操作(使用-r) -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor-cmd 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 --with-revprop ARG : set revision property ARG in new revision using the name[=value] format 使用name[=value]格式在新版本中設置修訂屬性ARG --force : force operation to run 強制操作運行 Global options: //與上面相同,在此省略
使用外部編輯器編輯屬性
舉例:
svn propedit svn:keywords versioned-2 //修改versioned-2上的svn:keywords屬性
26.propget (pget, pg)
是否訪問存儲庫:當訪問庫地址時是
格式:
1. propget PROPNAME [TARGET[@REV]...] 2. propget PROPNAME --revprop -r REV [TARGET]
1. 打印版本化的屬性。如果指定,REV將確定首先查找目標的修訂版本。
2. 在repos修訂上打印未版本的遠程屬性。
TARGET只確定要訪問哪個存儲庫。
使用--verbose,目標路徑和屬性名在每個值之前打印在不同的行上,比如“svn proplist——verbose”。
否則,如果有多個目標或'empty'以外的深度,則在每個值之前的同一行上打印目標路徑。
默認情況下,在屬性值之后會打印一個額外的換行符,這樣輸出看起來很漂亮。對於單個目標,depth為'empty'和無—show-inherited-props時,可以使用--no-newline選項禁用該選項(例如,在將二進制屬性值重定向到文件時非常有用)。
有關svn:*特殊屬性的描述,請參見“svn help propset”。
選項:
Valid options: -v [--verbose] : print path, name and value on separate lines 在單獨的行上打印路徑、名稱和值 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 --revprop : operate on a revision property (use with -r) 在修訂版本號屬性中操作(使用-r) --strict : (deprecated; use --no-newline) 棄用,現在使用--no-newline --no-newline : do not output the trailing newline 不輸出尾部換行符 --xml : output in XML 以XML格式輸出 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG的成員進行操作 --show-inherited-props : retrieve properties set on parents of the target檢索目標的父節點上設置的屬性 Global options: //與上面相同,在此省略
將屬性的值打印到文件、目錄或修訂版本上
舉例:
svn propget svn:keywords versioned-2 //從versioned-2中取得svn:keywords屬性的值
27.proplist (plist, pl)
是否訪問存儲庫:當訪問庫地址時是
格式:
1. proplist [TARGET[@REV]...] 2. proplist --revprop -r REV [TARGET]
1. 列出版本化的屬性。如果指定,REV將確定首先查找目標的修訂版本。
2. 列出在repos修訂上的未版本的遠程屬性。
TARGET只確定要訪問哪個存儲庫。
使用--verbose,屬性值也會打印出來,比如“svn propget --verbose”。使用--quiet,路徑沒有被打印出來。
有關svn:*特殊屬性的描述,請參見“svn help propset”。
選項:
Valid options: -v [--verbose] : print path, name and value on separate lines 在單獨的行上打印路徑、名稱和值 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --revprop : operate on a revision property (use with -r) 在修訂版本號屬性中操作(使用-r) --xml : output in XML 以XML格式輸出 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG的成員進行操作 --show-inherited-props : retrieve properties set on parents of the target檢索目標的父節點上設置的屬性 Global options: //與上面相同,在此省略
列出文件、目錄或修訂中的所有屬性
舉例:
svn proplist --verbose versioned-2
28.propset (pset, ps)
是否訪問存儲庫:當訪問庫地址時是
格式:
1. propset PROPNAME PROPVAL PATH... 2. propset PROPNAME --revprop -r REV PROPVAL [TARGET]
1. 更改工作副本中版本化的文件或目錄屬性。
2. 更改存儲庫修訂上的未版本化屬性。(TARGET只決定訪問哪個存儲庫。)
可以使用--file選項而不是PROPVAL提供該值
以“svn:”開頭的屬性名是保留的。
Subversion識別文件上的以下特殊版本屬性:
svn:keywords -要展開的關鍵字。有效的關鍵詞是:
- URL, HeadURL - The URL for the head version of the file. 文件頭部版本的URL
- Author, LastChangedBy - The last person to modify the file. 最后一個修改文件的人
- Date, LastChangedDate - The date/time the file was last modified. 文件最后一次修改的日期/時間
- Rev, Revision, - The last revision the file changed. 文件更改的最后一個修訂版本
- LastChangedRevision
- Id - A compressed summary of the previous four.前4個的壓縮摘要
- Header - Similar to Id but includes the full URL. 類似於Id,但包含完整的URL
Custom keywords can be defined with a format string separated from the keyword name with '='. Valid format substitutions are:
自定義關鍵字可以用格式字符串定義,格式字符串與關鍵字名稱用'='分隔。有效的格式替換如下:
%a - The author of the revision given by %r. 由%r給出的修訂的作者
%b - The basename of the URL of the file. 文件URL的basename
%d - Short format of the date of the revision given by %r. 由%r提供的修訂日期的簡短格式
%D - Long format of the date of the revision given by %r. %r給出的修訂日期的長格式
%P - The file's path, relative to the repository root. 文件相對於存儲庫根目錄的路徑
%r - The number of the revision which last changed the file. 最后修改文件的版本號
%R - The URL to the root of the repository. 存儲庫根目錄的URL
%u - The URL of the file. 文件的URL
%_ - A space (keyword definitions cannot contain a literal space).空格(關鍵字定義不能包含文字空格)
%% - A literal '%'. 字面上的“%”
%H - Equivalent to %P%_%r%_%d%_%a. 相當於%P%_%r%_%d%_%a
%I - Equivalent to %b%_%r%_%d%_%a. 相當於%b%_%r%_%d%_%a
示例自定義關鍵字定義:: MyKeyword=%r%_%a%_%P
一旦為文件定義了自定義關鍵字,它就可以像其他關鍵字一樣在文件中使用: $MyKeyword$
svn:executable - 如果存在,使文件可執行。使用'svn propdel svn:executable PATH...'去清除
svn:eol-style - “native”、“LF”、“CR”、“CRLF”中的一個
svn:mime-type - 文件的mime類型。用於確定
是否合並文件,以及如何從Apache服務它。
以“text/”開頭的mimetype(或缺少的mimetype)被視為文本。其他的都是二進制的。
svn:needs-lock - 如果存在,表示文件在修改前應該被鎖定。使工作副本文件在未鎖定時為只讀。使用'svn propdel svn:needs-lock PATH...'去清除。
Subversion識別目錄上的以下特殊版本屬性:
svn:ignore - 要忽略的文件glob模式列表,每行一個.
svn:global-ignores - 類似svn:ignore,但可繼承.
svn:auto-props - 當文件被添加或導入時自動設置屬性。包含鍵-值對,每行一個,格式如下:
PATTERN = PROPNAME=VALUE[;PROPNAME=VALUE ...]
例子 (文字';'通過添加另一個';'來轉義):
*.html = svn:eol-style=native;svn:mime-type=text/html;; charset=UTF8
遞歸地應用於它所設置的目錄下添加或導入的所有文件。請參閱客戶端配置文件中的[auto-props]。
svn:externals - 模塊說明符列表,每行一個,以下格式類似於'svn checkout'的語法:
[-r REV] URL[@PEG] LOCALPATH
例子:
http://example.com/repos/zig foo/bar
LOCALPATH相對於具有此屬性的目錄.
要將外部固定到已知的修訂,請指定可選的REV,如:
-r25 http://example.com/repos/zig foo/bar
若要在路徑上明確標識可能隨后被刪除或重命名的元素,請指定可選的PEG修訂,如:
-r25 http://example.com/repos/zig@42 foo/bar
URL可以是一個完整的URL,也可以是一個相對的URL,開頭是:
- ../ 到提取的外部的父目錄
- ^/ 存儲庫的根目錄
- / 到服務器根目錄
- // 指向URL模式
- ^/../ 到相同SVNParentPath位置下的兄弟存儲庫
不鼓勵使用以下格式,但支持與Subversion 1.4及更早的客戶端進行互操作:
LOCALPATH [-r PEG] URL
具有peg修訂支持的不明確格式'relative_path relative_path'被視為'relative_url relative_path'.
以“#”字符開頭的行被忽略.
選項:
Valid options: -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --revprop : operate on a revision property (use with -r) 在修訂版本號屬性中操作(使用-r) 使用name[=value]格式在新版本中設置修訂屬性ARG --force : force operation to run 強制操作運行 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG成員進行操作 Global options: //與上面相同,在此省略
在文件、目錄或修訂版本上設置屬性的值
舉例:
1)
svn propset svn:mime-type image/jpeg myPicture.jpg //給file.jpg附加屬性svn:mime-type 其值為image/jpeg
2)
svn propset --revprop -r 2 svn:log "add some log info" //給版本2補上log message
3)
svn propset svn:ignore '.classpath' . //在本地忽略掉.classpath文件
29.relocate
格式:
1. relocate FROM-PREFIX TO-PREFIX [PATH...] 2. relocate TO-URL [PATH]
重寫工作復制URL元數據以僅反映語法更改。
當存儲庫的根URL發生更改(例如模式或主機名發生更改),但是你的工作副本仍然反映相同存儲庫中的相同目錄時,可以使用此方法。
1. FROM-PREFIX和TO-PREFIX分別是工作副本的當前url和新url的初始子字符串。(如果願意,可以指定完整的新舊url。)使用'svn info'確定當前的工作副本URL。
2. TO-URLL是用於PATH的(完整的)新存儲庫URL。
選項:
Valid options: --ignore-externals : ignore externals definitions Global options: //與上面相同,在此省略
重新定位工作副本以指向不同的存儲庫根URL
舉例:
svn relocate http:// svn:// project1 project2 svn relocate http://www.example.com/repo/project svn://svn.example.com/repo/project
30.resolve
是否訪問存儲庫:否
格式:
resolve [PATH...]
默認情況下,在PATH上執行交互式沖突解決。
在這種模式下,默認情況下命令是遞歸的(深度為'infinity')。
--accept=ARG選項防止交互式提示,並強制以ARG指定的方式解決PATH上的沖突。
在這種模式下,默認情況下命令不是遞歸的(深度'empty')。
沖突路徑不能使用'svn commit'提交,除非它被標記為使用'svn resolve'解析。
Subversion知道三種類型的沖突:
文本沖突
屬性沖突
樹沖突。
1)當對文件內容進行重疊更改時,會發生文本沖突。文本沖突通常通過編輯沖突的文件或使用合並工具(可能是外部程序)來解決。
“svn resolve”提供可用於自動編輯文件的選項(如'mine-full'或'theirs-conflict'),但這些選項僅在可以完全放棄本地或傳入更改的情況下有用。
2)屬性沖突通常通過編輯沖突屬性的值來解決(可以從交互式提示符中編輯,也可以使用“svn propedit”編輯)。與文本沖突一樣,存在自動編輯屬性的選項,放棄某些更改而選擇其他更改。
3)當對目錄結構進行更改時,以及當此更改不能應用於工作副本而不影響其他更改(文本更改、屬性更改或目錄結構的其他更改)時,就會發生樹沖突。關於樹沖突的簡要信息由'svn status'和'svn info'命令顯示。
在交互模式下,“svn resolve”將嘗試詳細描述樹沖突,並可能提供自動解決沖突的選項。
建議盡可能使用這些自動選項,而不要嘗試手動解決樹沖突。
如果無法自動解決樹沖突,建議在嘗試解決沖突之前找出沖突發生的原因。
“svn log -v”命令可用於檢查在過去的修訂中所做的結構更改,甚至可能用於檢查其他分支。
'svn help log'描述了這些結構更改是如何顯示的。
一旦沖突的“傳入”更改被識別為'svn log',當前的“本地”工作副本狀態應該進行檢查和調整,以解決沖突。這可能涉及手動編輯文件或使用'svn merge'。可能需要使用“svn revert”丟棄一些本地更改。文件或目錄可能需要復制、刪除或移動。
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --accept ARG : specify automatic conflict resolution source。 指定自動沖突解決源 ('base', 'working', 'mine-conflict','theirs-conflict', 'mine-full', 'theirs-full') Global options: //與上面相同,在此省略
解決工作拷貝文件或目錄上的沖突
將沖突的文件標記為已解決,並且刪掉沖突產生的臨時文件。注意這個命令並不是能把沖突解決,解決沖突還是得靠人工。
舉例:
svn resolve --accept mine-full versioned-2
31.resolved
是否訪問存儲庫:否
格式:
resolved PATH...
注意:此子命令不從語義上解決沖突或刪除沖突標記;它只是刪除與沖突相關的工件文件,並允許再次提交路徑。它已經被棄用,現支持運行'svn resolve --accept working'命令。
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 Global options: //與上面相同,在此省略
刪除工作拷貝文件或目錄上的“沖突”狀態
32.revert
是否訪問存儲庫:否
格式:
revert PATH...
在PATH處或PATH內恢復工作副本中的更改,如果有沖突標記,也要刪除它們。
此子命令不還原已提交的更改。
有關撤消已提交的更改的信息,請搜索'svn help merge'的輸出以查找'undo'。
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 傳遞ARG文件的內容作為額外參數 -R [--recursive] : descend recursively, same as --depth=infinity 向下遞歸,與--depth=infinity作用相同 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG成員進行操作 Global options: //與上面相同,在此省略
還原原始工作副本狀態(撤消本地更改)
svn revert --depth=infinity . //將整個目錄所有文件還原
33.status (stat, st)
是否訪問存儲庫:加上--show-updates參數時會
格式:
status [PATH...]
如果沒有args,只打印本地修改的項(沒有網絡訪問)。
使用-q,只打印關於本地修改項的摘要信息。
使用-u,添加工作修訂和服務器過期信息。
使用-v,打印每個項目的完整修訂信息。
輸出的前7列的寬度是每個字符的寬度:
第一列:表示是否添加、刪除或以其他方式更改項
' ' no modifications 無修改
'A' Added 添加
'C' Conflicted 沖突
'D' Deleted 刪除
'I' Ignored 忽視
'M' Modified 修改
'R' Replaced 替換
'X' an unversioned directory created by an externals definition 被一個外部定義創造的未版本化目錄
'?' item is not under version control 不在版本控制下的條目
'!' item is missing (removed by non-svn command) or incomplete 丟失(被非svn命令移除)或不完全的條目
'~' versioned item obstructed by some item of a different kind 被來自一些不同類型的條目妨礙的版本化條目
第二列:文件或目錄屬性的修改
' ' no modifications 無修改
'C' Conflicted 沖突
'M' Modified 修改
第三列:工作副本是否鎖定,以便由另一個Subversion客戶端修改工作副本進行寫入
' ' not locked for writing 為了寫入沒有鎖定
'L' locked for writing 為了寫入而上鎖
第四列:計划提交將創建一個副本(添加歷史記錄)
' ' no history scheduled with commit (item was newly added) (條目是新添加的)
'+' history scheduled with commit (item was copied) 沒有使用commit調度歷史記錄
第五列:是切換項還是文件外部
' ' normal 正常
'S' the item has a Switched URL relative to the parent 項具有相對於父項的切換URL
'X' a versioned file created by an eXternals definition 由外部定義創建的版本化文件
第六列:是否將項鎖定在存儲庫中進行獨占提交(無-u)
' ' not locked by this working copy 未被此工作副本鎖定
'K' locked by this working copy, but lock might be stolen or broken(with -u)
被此工作副本鎖定,但鎖可能被盜或被破壞(使用-u)
' ' not locked in repository, not locked by this working copy
沒有被鎖定在存儲庫中,沒有被這個工作副本鎖定
'K' locked in repository, lock owned by this working copy
鎖定在存儲庫中,此工作副本所擁有的鎖定
'O' locked in repository, lock owned by another working copy
鎖定在存儲庫中,屬於另一個工作副本的鎖定
'T' locked in repository, lock owned by this working copy was stolen
鎖定在存儲庫中,此工作副本所擁有的鎖被盜
'B' not locked in repository, lock owned by this working copy is broken
未鎖定在存儲庫中,此工作副本所擁有的鎖被破壞
第七列:項目是否為樹沖突的受害者
' ' normal 正常
'C' tree-Conflicted 樹沖突
如果項目是樹沖突受害者,則在項目的狀態行之后打印另一行,解釋沖突的性質。
過時的資料列在第九列(以-u):
'*' a newer revision exists on the server 服務器上存在一個更新的修訂
' ' the working copy is up to date 工作副本是最新的
其余字段為可變寬度,以空格分隔:
- 工作修訂(-u或-v;'-'如果項目被復制)
- 最后提交的修訂和最后提交的作者(帶-v)
- 工作復制路徑始終是最后一個字段,因此它可以包含空格。
在需要工作修訂、最近提交的修訂或最后提交的作者的情況下,問號('?')的存在表明,在給定項的狀態下,信息是未知的或不相關的(例如,當項是復制操作的結果時)。
問號用作可視化占位符,以便於解析。
選項:
Valid options: -u [--show-updates] : display update information 顯示更新內容 -v [--verbose] : print extra information 打印額外信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --no-ignore : disregard default and svn:ignore and svn:global-ignores property ignores 忽略默認值和svn:ignore和svn:global-ignores屬性忽略 --incremental : give output suitable for concatenation 給出適合串聯的輸出 --xml : output in XML 以XML格式輸出 --ignore-externals : ignore externals definitions 忽略外部定義 --changelist [--cl] ARG : operate only on members of changelist ARG 只對ARG這個changelist成員進行操作 Global options: //與上面相同,在此省略
打印工作復制文件和目錄的狀態
例子:
userdeMBP:foo user$ svn status A newdir D unversioned-1 D versioned-1 > moved to versioned-2 A + versioned-2 > moved from versioned-1 userdeMBP:foo user$ svn status -u A * - newdir D O 7 versioned-1 > moved to versioned-2 A + - versioned-2 > moved from versioned-1 D * 7 unversioned-1 * 7 . Status against revision: 9 userdeMBP:foo user$ svn status --show-updates --verbose A * - ? ? newdir 7 1 boss centos7/.vagrant 7 1 boss centos7/.vagrant/machines 7 1 boss centos7/.vagrant/machines/default 7 1 boss centos7/.vagrant/machines/default/virtualbox 7 1 boss centos7/.vagrant/machines/default/virtualbox/vagrant_cwd 7 1 boss centos7/.vagrant/rgloader 7 1 boss centos7/.vagrant/rgloader/loader.rb 7 6 boss centos7/Vagrantfile 7 6 boss centos7 D O 7 6 boss versioned-1 > moved to versioned-2 A + - 6 boss versioned-2 > moved from versioned-1 D * 7 7 boss unversioned-1 * 7 7 boss . Status against revision: 9
34.switch (sw)
是否訪問存儲庫:是
格式:
usage: 1. switch URL[@PEGREV] [PATH] 2. switch --relocate FROM-PREFIX TO-PREFIX [PATH...]
1. 在存儲庫中更新工作副本去鏡像新的URL。
這種行為類似於'svn update',是將工作副本移動到同一存儲庫中的分支或標記的方式。
如果指定,PEGREV將確定首先查找目標的修訂版本。
如果使用--force,如果開關試圖添加相同的路徑,工作副本中的未版本化阻塞路徑不會自動導致失敗。如果阻塞路徑的類型(文件或目錄)與存儲庫中相應的路徑相同,那么它將被版本化,但其內容在工作副本中保留為“原樣”。
這意味着一個阻塞目錄的未版本化的子目錄也可能阻塞並成為版本化的。對於文件,阻塞和存儲庫之間的任何內容差異都被視為對工作副本的本地修改。存儲庫中的所有屬性都應用於阻塞路徑。
使用--set-depth選項在此操作的目標上設置新的工作副本深度。
默認情況下,Subversion將拒絕將工作復制路徑切換到一個新的URL,該URL與Subversion沒有共享的版本控制祖先。
使用“--ignore-ancestry”選項覆蓋這個完整性檢查。
2. “--relocate”選項已被棄用。這個語法相當於'svn relocate FROM-PREFIX TO-PREFIX [PATH]'命令。
請參閱'svn help update' 以獲得報告所采取的操作的可能字符列表。
選項:
Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) 變量ARG可以設置為ARG1:ARG2范圍格式 A revision argument can be one of:修訂號參數可為下面之一 NUMBER revision number 修訂號 '{' DATE '}' revision at start of the date 在該日期開始時的修訂 'HEAD' latest in repository 存儲庫中的最新版 'BASE' base rev of item's working copy 項目工作副本的基本修訂版 'COMMITTED' last commit at or before BASE 在BASE中或前的最后一次上傳 'PREV' revision just before COMMITTED 在COMMITTED之前的修訂 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 -N [--non-recursive] : obsolete; try --depth=files or --depth=immediates 已經廢棄;嘗試--depth=files或--depth=immediates標志 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --force : force operation to run 強制操作運行 --ignore-externals : ignore externals definitions 忽略外部定義 --set-depth ARG : set new working copy depth to ARG ('exclude','empty', 'files', 'immediates', or 'infinity') 設置新的工作副本長度為ARG('exclude','empty', 'files', 'immediates', or 'infinity') --diff3-cmd ARG : use ARG as merge command 使用ARG作為合並命令 --ignore-ancestry : allow switching to a node with no common ancestor 允許切換到沒有共同祖先的節點 --accept ARG : specify automatic conflict resolution action 指定自動沖突解決操作 ('postpone', 'working', 'base', 'mine-conflict','theirs-conflict', 'mine-full', 'theirs-full','edit', 'launch', 'recommended') (shorthand:'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l', 'r') 對應的縮寫 --relocate : deprecated; use 'svn relocate' 棄用;現在使用'svn relocate' Global options: //與上面相同,在此省略
將工作副本更新到同一存儲庫中的另一個URL
舉例:
svn switch ^/branches/1.x-release svn switch --relocate http:// svn:// svn switch --relocate http://www.example.com/repo/project svn://svn.example.com/repo/project
35.unlock
是否訪問存儲庫:是
格式:
unlock TARGET...
解鎖工作復制路徑或url
選項:
Valid options: --targets ARG : pass contents of file ARG as additional args 傳遞文件ARG的內容作為額外參數 --force : break locks 打破鎖 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 Global options: //與上面相同,在此省略
使用--force斷開另一個用戶或工作副本持有的鎖
舉例,解鎖之前lock處上鎖的文件:
userdeMBP:foo user$ svn unlock svn://localhost/myCode/versioned-1 'svn://localhost/myCode/versioned-1' unlocked.
36.upgrade
是否訪問存儲庫:是
格式:
upgrade [WCPATH...]
保留局部修改
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 Global options: //與上面相同,在此省略
升級工作副本的元數據存儲格式
下面的內容還在實驗階段,先了解即可
37.x-shelve (shelve)
格式:
1. x-shelve [--keep-local] NAME [PATH...] 2. x-shelve --delete NAME 3. x-shelve --list
1. 將給定路徑中的本地更改保存到補丁文件中,並從WC中恢復該更改,除非給出了“--keep-local”。
如果日志消息中包含“-m”或“-F”,則將其包含在補丁文件的開頭。
2. 刪除擱置的更改名稱。(保存備份,命名為'.bak'的擴展)。
3.列舉擱置更改。包括任何日志消息的第一行和關於更改內容的一些細節,除非給出“-q”。
可以擱置的更改類型是“svn diff”和“svn patch”支持的更改。目前不支持以下內容:合並信息更改(mergeinfo changes)、copies, moves, mkdir, rmdir、“二進制”內容('binary' content)、不可提交狀態(uncommittable states)
要恢復擱置的更改,請使用“svn x-unshelve NAME”。
擱置的更改存儲在<WC>/.svn/shelves/中
擱置功能是實驗性的。這個命令很可能在下一個版本中更改,並且不保證向后兼容。
選項:
Valid options: --delete : delete the shelved patch 刪除擱置的補丁 --list : list shelved patches 列舉擱置的補丁 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --dry-run : try operation but make no changes 嘗試操作但不造成更改 --keep-local : keep path in working copy 保持工作副本中的路徑 --depth ARG : limit operation by depth ARG ('empty', 'files','immediates', or 'infinity') 通過depth ARG ('empty', 'files','immediates', or 'infinity')設置來限制操作 --targets ARG : pass contents of file ARG as additional args 傳遞文件ARG的內容作為額外參數 --changelist [--cl] ARG : operate only on members of changelist ARG 只對更改列表,即ARG的成員進行操作 -m [--message] ARG : specify log message ARG 指定日志信息(即注釋) -F [--file] ARG : read log message from file ARG 從文件ARG中讀取日志信息 --force-log : force validity of log message source 強制日志消息源的有效性 --editor-cmd ARG : use ARG as external editor-cmd 使用ARG作為外部編輯器 --encoding ARG : treat value as being in charset encoding ARG 將值編碼為ARG字符集編碼格式的值 Global options: //與上面相同,在此省略
把本地更改先放在一邊,就像把它放在架子上一樣
38.x-unshelve (unshelve)
格式:
1. x-unshelve [--keep-shelved] [NAME] 2. x-unshelve --list
1. 將擱置的更改名稱應用於工作副本。
刪除補丁,除非給出'--keep-shelved'選項。(保存備份,命名為'.bak'的擴展)。
名稱默認為最近擱置的更改。
2. 擱置更改列表。包括任何日志消息的第一行和關於更改內容的一些細節,除非給出“-q”。
未擱置的更改與WC中已經存在的更改之間的任何沖突都將以與'svn patch'相同的方式處理,即創建一個“拒絕”文件。
擱置功能是實驗性的。這個命令很可能在下一個版本中更改,並且不保證向后兼容。
選項:
Valid options: --keep-shelved : do not delete the shelved patch 不刪除擱置的補丁 --list : list shelved patches 列舉擱置的補丁 -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 --dry-run : try operation but make no changes 嘗試操作但不造成更改 Global options: //與上面相同,在此省略
將擱置的更改帶回WC中的本地更改
39.x-shelves (shelves)
格式:
x-shelves
在WC中將擱置更改恢復到本地更改擱置特性是實驗性的。這個命令很可能在下一個版本中更改,並且不保證向后兼容。
選項:
Valid options: -q [--quiet] : print nothing, or only summary information 什么都不打印,或者只是總結信息 Global options: //與上面相同,在此省略
列舉擱置的變化