在只装了TortoiseSVN的情况下不想装其它svn工具,其实TortoiseSVN也是通过命令来控制的。只是传的不同的参数

TortoiseSVN的GUI程序叫做TortoiseProc.exe。所有的命令通过参数/command:abcd指定,其中abcd是必须的命令名。大多数此类命令至少需要一个路径参数,使用/path:"some\path"指定。在下面的命令表格中,命令引用的是/command:abcd参数,余下的代表了/path:"some\path"参数



因为一些命令需要一个目标路径的列表(例如提交一些特定的文件),/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.

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 OK

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 /closeonendparameter.


  • /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 /path specifies the file or folder for which the log should be shown. Additional options can be set: /startrev:xxx,/endrev:xxx/strict enables the 'stop-on-copy' checkbox, /merge enables the 'include merged revisions' checkbox, /findstring:"filterstring" fills in the filter text, /findtext forces the filter to use text, not regex, or /findregex forces the filter to use regex, not simple text search, and/findtype:X with X being a number between 0 and 511. The numbers are the sum of the following options:



  • /findtype:0 filter by everything
  • /findtype:1 filter by messages
  • /findtype:2 filter by path
  • /findtype:4 filter by authors
  • /findtype:8 filter by revisions
  • /findtype:16 not used
  • /findtype:32 filter by bug ID
  • /findtype:64 not used
  • /findtype:128 filter by date
  • /findtype:256 filter by date range


If /outfile:path\to\file is specified, the selected revisions are written to that file when the log dialog is closed. The revisions are written in the same format as is used to specify revisions in the merge dialog.

:checkout

Opens the checkout dialog. The /path specifies the target directory and the /url specifies the URL to checkout from. If you specify the key/blockpathadjustments, the automatic checkout path adjustments are blocked. The /revision:XXX specifies the revision to check out.

: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 显示日志

:commit

打开提交对话框,/path 指定了目标路径或需要提交的文件列表,你也可以使用参数 /logmsg 给提交窗口传递预定义的日志信息,或者你不希望将日志传递给命令行,你也可以使用 /logmsgfile:pathpath 指向了保存日志信息的文件。为了预先填入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. 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, /revert/delunversioned/delignored/refreshshell and /externals.

: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 eitherlocalchanges to only export files that got changed locally, or unversioned 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.

: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. For doing a reintegrate merge, use the following options: /fromurl:URL and /reintegrate. These pre-fill the relevant fields in the merge dialog.

:mergeall

Opens the merge all dialog. The /path specifies the target directory.

:copy

Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. To already check the option Switch working copy to new branch/tag you can pass the /switchaftercopy 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 pathpoints to a file containing the log message.

:settings

打开设置对话框。

:remove

从版本控制里移除/path中的文件。

:rename

重命名/path的文件,会在对话框中询问新文件,为了防止一个步骤中询问相似文件,传递/noquestion

:diff

Starts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx, 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.

:showcompare

Depending on the URLs and revisions to compare, this either shows a unified diff (if the option unified is set), a dialog with a list of files that have changed or if the URLs point to files starts the diff viewer for those two files.

The options url1url2revision1 and revision2 must be specified. The options pegrevisionignoreancestryblame and unified are 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

Opens the check-for-modifications dialog. The /path specifies the working copy directory. If /remote is specified, the dialog contacts the repository immediately on startup, as if the user clicked on the Check repository

:repobrowser

Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL.

An additional option /rev:xxx can be used to specify the revision which the repository browser should show. If the /rev:xxx is omitted, it defaults to HEAD.

If /path points to an URL, the /projectpropertiespath:path/to/wc specifies the path from where to read and use the project properties.

If /outfile:path\to\file is specified, the selected URL and revision are written to that file when the repository browser is closed. The first line in that text file contains the URL, the second line the revision in text format.

:ignore

/path中的对象加入到忽略列表,也就是将这些文件添加到 svn:ignore 属性。

:blame

为 /path 选项指定的文件打开追溯对话框。

如果设置了 /startrev 和 /endrev 选项,不会显示询问追溯范围对话框,直接使用这些选项中的版本号。

如果设置了 /line:nnn 选项,TortoiseBlame 会显示指定行数。

也支持 /ignoreeol/ignorespaces 和 /ignoreallspaces 选项。

: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.

:revisiongraph

按照在/path中给出的路径显示版本分支图。

To create an image file of the revision graph for a specific path, but without showing the graph window, pass /output:path with the path to the output file. The output file must have an extension that the revision graph can actually export to. These are: .svg.wmf.png.jpg.bmpand .gif.

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 /options:XXXX, where XXXX is a decimal value. The best way to find the required options is to start the revision graph the usual way, set all user-interface options and close the graph. Then the options you need to pass on the command line can be read from the registry HKCU\Software\TortoiseSVN\RevisionGraphOptions.

:lock

Locks a file or all files in a directory given in /path. The 'lock' dialog is shown so the user can enter a comment for the lock.

:unlock

Unlocks a file or all files in a directory given in /path.

:rebuildiconcache

Rebuilds the windows icon cache. Only use this in case the windows icons are corrupted. A side effect of this (which can't be avoided) is that the icons on the desktop get rearranged. To suppress the message box, pass /noquestion.

:properties

Shows the properties dialog for the path given in /path.

For dealing with versioned properties this command requires a working copy.

Revision properties can be viewed/changed if /path is an URL and /rev:XXX is specified.

To open the properties dialog directly for a specific property, pass the property name as /property:name.



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