因为所有的命令使用命令行参数控制,你可以使用特定的批处理脚本或从其它程序(例如你喜欢的文本编辑器)启动。
请记住TortoiseSVN是一个GUI客户端,这个自动化指导为你展示了让TortoiseSVN对话框显示并收集客户输入,如果你希望编写不需要输入的脚本,你应该使用官方的Subversion命令行客户端。
TortoiseSVN的GUI程序叫做TortoiseProc.exe
。所有的命令通过参数/command:abcd
指定,其中abcd
是必须的命令名。大多数此类命令至少需要一个路径参数,使用/path:"some\path"
指定。在下面的命令表格中,命令引用的是/command:abcd
参数,余下的代表了/path:"some\path"
参数。
There's a special command that does not require the parameter /command:abcd
but, if nothing is specified on the command line, starts the project monitor instead. If /tray
is specified, the project monitor starts hidden and only adds its icon to the system tray.
因为一些命令需要一个目标路径的列表(例如提交一些特定的文件),/path
参数可以接收多个路径,使用*
分割。
You can also specify a file which contains a list of paths, separated by newlines. The file must be in UTF-16 format, without a BOM. If you pass such a file, use /pathfile
instead of /path
. To have TortoiseProc delete that file after the command is finished, you can pass the parameter /deletepathfile
. If you don't pass /deletepathfile
, you have to delete the file yourself or the file gets left behind.
The progress dialog which is used for commits, updates and many more commands usually stays open after the command has finished until the user presses the
button. This can be changed by checking the corresponding option in the settings dialog. But using that setting will close the progress dialog, no matter if you start the command from your batch file or from the TortoiseSVN context menu.To specify a different location of the configuration file, use the parameter /configdir:"path\to\config\directory"
. This will override the default path, including any registry setting.
To close the progress dialog at the end of a command automatically without using the permanent setting you can pass the /closeonend
parameter.
/closeonend:0
不自动关闭对话框
/closeonend:1
如果没发生错误则自动关闭对话框
/closeonend:2
如果没发生错误和冲突则自动关闭对话框
/closeonend:3
如果没有错误、冲突和合并,会自动关闭
To close the progress dialog for local operations if there were no errors or conflicts, pass the /closeforlocal
parameter.
下面的列表列出了所有可以使用TortoiseProc.exe访问的命令,就像上面的描述,必须使用/command:abcd
的形式,在列表中,因为节省空间的关系省略了/command
的前缀。
表 D.1. 有效命令及选项列表
命令 | 描述 |
---|---|
:about | 显示关于对话框。如果没有给命令也会显示。 |
:log |
Opens the log dialog. The
An svn date revision can be in one of the following formats:
|
:checkout |
Opens the checkout dialog. The If you specify |
:import | Opens the import dialog. The /path specifies the directory with the data to import. You can also specify the /logmsg switch to pass a predefined log message to the import 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. |
:update | Updates the working copy in /path to HEAD. If the option /rev is given then a dialog is shown to ask the user to which revision the update should go. To avoid the dialog specify a revision number /rev:1234 . Other options are /nonrecursive , /ignoreexternals and /ignoreexternals . The /stickydepth indicates that the specified depth should be sticky, creating a sparse checkout. The /skipprechecks can be set to skip all checks that are done before an update. If this is specified, then the 显示日志 button is disabled, and the context menu to show diffs is also disabled after the update. |
:commit | 打开提交对话框,/path 指定了目标路径或需要提交的文件列表,你也可以使用参数 /logmsg 给提交窗口传递预定义的日志信息,或者你不希望将日志传递给命令行,你也可以使用 /logmsgfile:path ,path 指向了保存日志信息的文件。为了预先填入bug的ID(如果你设置了集成bug追踪属性),你可以使用/bugid:"the bug id here" 完成这个任务。 |
:add | 将/path 的文件添加到版本控制 。 |
:revert | 恢复工作副本的本地修改,/path 说明恢复哪些条目。 |
:cleanup | Cleans up interrupted or aborted operations and unlocks the working copy in /path . You also have to pass the /cleanup to actually do the cleanup. Use /noui to prevent the result dialog from popping up (either telling about the cleanup being finished or showing an error message). /noprogressui also disables the progress dialog. /nodlg disables showing the cleanup dialog where the user can choose what exactly should be done in the cleanup. The available actions can be specified with the options /cleanup for status cleanup, /breaklocks to break all locks, /revert to revert uncommitted changes, /delunversioned , /delignored , /refreshshell , /externals , /fixtimestamps and /vacuum . |
:resolve | 将/path 指定文件的冲突标示为解决,如果给定/noquestion ,解决不会向用户确认操作。 |
:repocreate | 在/path 创建一个版本库。 |
:switch | Opens the switch dialog. The /path specifies the target directory and /url the URL to switch to. |
:export | Exports the working copy in /path to another directory. If the /path points to an unversioned directory, a dialog will ask for an URL to export to the directory in /path . If you specify the key /blockpathadjustments , the automatic export path adjustments are blocked. |
:dropexport | Exports the working copy in /path to the directory specified in /droptarget . This exporting does not use the export dialog but executes directly. The option /overwrite specifies that existing files are overwritten without user confirmation, and the option /autorename specifies that if files already exist, the exported files get automatically renamed to avoid overwriting them. The option /extended can specify either 本地修改 to only export files that got changed locally, or 没有版本控制 to also export all unversioned items as well. |
:dropvendor | Copies the folder in /path recursively to the directory specified in /droptarget . New files are added automatically, and missing files get removed in the target working copy, basically ensuring that source and destination are exactly the same. Specify /noui to skip the confirmation dialog, and /noprogressui to also disable showing the progress dialog. |
: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 . |
:mergeall | 打开全部合并对话框,/path 指定目标文件夹 |
:copy | Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. If the urls starts with a ^ it is assumed to be relative to the repository root. To already check the option 从工作副本切换到新分支 you can pass the /switchaftercopy switch. To check the option 创建临时文件夹 pass the /makeparents switch. 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. If the specified file also has property modifications, the external diff tool is also started for each modified property. To prevent that, pass the option /ignoreprops . To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx , and for the optional peg revision use /pegrevision:xxx . If /blame is set and /path2 is not set, then the diff is done by first blaming the files with the given revisions. The parameter /line:xxx specifies the line to jump to when the diff is shown. |
:shelve | Shelves the specified paths in a new shelf. The option /shelfname:name specifies the name of the shelf. An optional log message can be specified with /logmsg:message . If option /checkpoint is passed, the modifications of the files are kept. |
:unshelve | Applies the shelf with the name /shelfname:name to the working copy path. By default the last version of the shelf is applied, but you can specify a version with /version:X . |
:showcompare |
Depending on the URLs and revisions to compare, this either shows a unified diff (if the option The options If the specified url also has property modifications, the external diff tool is also started for each modified property. To prevent that, pass the option If a unified diff is requested, an optional |
: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 指定工作副本目录。如果已指定 /remote ,对话框将在启动时立即联系版本库,如同用户点击了 检查版本库 按钮。 |
:repobrowser |
Starts the repository browser dialog, pointing to the URL of the working copy given in An additional option 如果 If |
:ignore | 将/path 中的对象加入到忽略列表,也就是将这些文件添加到 svn:ignore 属性。 |
:blame |
为 如果设置了 如果设置了 也支持 |
:cat | 将/path 指定的工作副本或URL的文件保存到/savepath:path ,修订版本号在/revision:xxx ,这样可以得到特定修订版本的文件。 |
:createpatch | Creates a patch file for the path given in /path . To skip the file Save-As dialog you can pass /savepath:path to specify the path where to save the patch file to directly. To prevent the unified diff viewer from being started showing the patch file, pass /noview . If a unified diff is requested, an optional prettyprint option can be specified which will show the merge-info properties in a more user readable format. |
:revisiongraph |
按照在 To create an image file of the revision graph for a specific path, but without showing the graph window, pass Since the revision graph has many options that affect how it is shown, you can also set the options to use when creating the output image file. Pass these options with |
:lock | 锁定/path 提供的目录中的一个或者全部文件。弹出锁定对话框以便用户可以输入锁定的备注。 |
:unlock | 解锁/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 |
这个处理版本属性命令需要一个工作副本。 如果 为打开特点属性而打开属性对话框, |
:sync |
导出/导入设置,依赖于当前设置和导出设置哪个更新,或者是指定的更新 如果路径通过
If neither 如果 If The parameter |
Examples (which should be entered on one line):
TortoiseProc.exe /command:commit /path:"c:\svn_wc\file1.txt*c:\svn_wc\file2.txt" /logmsg:"test log message" /closeonend:0 TortoiseProc.exe /command:update /path:"c:\svn_wc\" /closeonend:0 TortoiseProc.exe /command:log /path:"c:\svn_wc\file1.txt" /startrev:50 /endrev:60 /closeonend:0