Apêndice D. Automatizando o TortoiseSVN


Comandos do TortoiseSVN
Controlador de URL do Tsvncmd
Comandos do TortoiseIDiff
Comandos TortoiseUDiff

Since all commands for TortoiseSVN are controlled through command line parameters, you can automate it with batch scripts or start specific commands and dialogs from other programs (e.g. your favourite text editor).


Remember that TortoiseSVN is a GUI client, and this automation guide shows you how to make the TortoiseSVN dialogs appear to collect user input. If you want to write a script which requires no input, you should use the official Subversion command line client instead.

Comandos do TortoiseSVN

The TortoiseSVN GUI program is called TortoiseProc.exe. All commands are specified with the parameter /command:abcd where abcd is the required command name. Most of these commands need at least one path argument, which is given with /path:"some\path". In the following table the command refers to the /command:abcd parameter and the path refers to the /path:"some\path" parameter.

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.

Since some of the commands can take a list of target paths (e.g. committing several specific files) the /path parameter can take several paths, separated by a * character.

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 OK 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 não fechar o diálogo automaticamente

  • /closeonend:1 fechar automaticamente se não houver erros

  • /closeonend:2 fechar automaticamente se não houver erros e conflitos

  • /closeonend:3 fechar automaticamente se não houver erros, conflitos e combinações

To close the progress dialog for local operations if there were no errors or conflicts, pass the /closeforlocal parameter.

The table below lists all the commands which can be accessed using the TortoiseProc.exe command line. As described above, these should be used in the form /command:abcd. In the table, the /command prefix is omitted to save space.

Tabela D.1. Lista de comandos e opções disponíveis

:aboutShows the about dialog. This is also shown if no command is given.

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,

  • /limit:xxx limits the amount of fetched messages

  • /strict enables the 'stop-on-copy' checkbox,

  • /merge enables the 'include merged revisions' checkbox,

  • /datemin:"{datestring}" sets the start date of the filter, and

  • /datemax:"{datestring}" sets the end date of the filter. The date format is the same as used for svn date revisions.

  • /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 filtrar por tudo

    • /findtype:1 filtrar por mensagens

    • /findtype:2 filtrar pelo caminho

    • /findtype:4 filter by authors

    • /findtype:8 filtrar por revisão

    • /findtype:16 não usado

    • /findtype:32 filtrar pelo ID do erro

    • /findtype:64 não usado

    • /findtype:128 filtrar por data

    • / Findtype: 256 filtrar por intervalo de datas

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

An svn date revision can be in one of the following formats:

  • {2006-02-17}

  • {15:30}

  • {15:30:00.200000}

  • {"2006-02-17 15:30"}

  • {"2006-02-17 15:30 +0230"}

  • {2006-02-17T15:30}

  • {2006-02-17T15:30Z}

  • {2006-02-17T15:30-04:00}

  • {20060217T1530}

  • {20060217T1530Z}

  • {20060217T1530-0500}


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.

If you specify /outfile:"path/to/file" the specified file will contain three lines after a checkout. The first line is the checkout path, the second line the url and the third the revision.

:importOpens 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:caminho, where caminho points to a file containing the log message.
:updateUpdates 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 /includeexternals. 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 Mostrar log button is disabled, and the context menu to show diffs is also disabled after the update.
:commitOpens the commit dialog. The /path specifies the target directory or the list of files to commit. You can also specify the /logmsg switch to pass a predefined log message to the commit dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:caminho, where caminho points to a file containing the log message. To pre-fill the bug ID box (in case you've set up integration with bug trackers properly), you can use the /bugid:"o código do erro aqui" to do that.
:addAdds the files in /path to version control.
:revertReverts local modifications of a working copy. The /path tells which items to revert.
:cleanupCleans 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.
:resolveMarks a conflicted file specified in /path as resolved. If /noquestion is given, then resolving is done without asking the user first if it really should be done.
:repocreateCria um repositório em /path
:switchAbre a caixa de diálogo trocar. O /path especifica a pasta de destino e o /url o URL de destino da troca.
:exportExports 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.
:dropexportExporta a cópia de trabalho em /path para a pasta especificada em /droptarget. Esta exportação não usa a caixa de diálogo exportar, mas executa-a directamente. A opção /overwrite indica que os ficheiros existentes são sobrepostos sem informação ao utilizador, e a opção /autorename indica que se os ficheiros já existirem, os ficheiros exportados serão automaticamente renomeados para evitar sobreposições. A opção /extended pode indicar alterações locais para só exportar ficheiros que foram alterados localmente, ou Não versionado exportar também todos os itens não versionados.
:dropvendorCopies 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.
:mergeOpens the merge dialog. The /path specifies the target directory. For merging a revision range, the following options are available: /fromurl:URL, /revrange:texto. For merging two repository trees, the following options are available: /fromurl:URL, /tourl:URL, /fromrev:xxx and /torev:xxx.
:mergeallOpens the merge all dialog. The /path specifies the target directory.
:copyBrings 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 Troca a cópia de trabalho para o novo ramo/etiqueta you can pass the /switchaftercopy switch. To check the option Criar pastas intermediárias 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:caminho, where caminho points to a file containing the log message.
:settingsAbre a janela de configurações.
:removeRemoves the file(s) in /path from version control.
:renameRenames the file in /path. The new name for the file is asked with a dialog. To avoid the question about renaming similar files in one step, pass /noquestion.
:diffStarts 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.
:shelveShelves 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.
:unshelveApplies 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.

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 url1, url2, revision1 and revision2 must be specified. The options pegrevision, ignoreancestry, blame and unified are optional.

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

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.

:conflicteditorStarts the conflict editor specified in the TortoiseSVN settings with the correct files for the conflicted file in /path.
:relocateOpens the relocate dialog. The /path specifies the working copy path to relocate.
:helpAbre o arquivo de ajuda.
:repostatusOpens 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 Verificar o repositório button.

Arranca a caixa de diálogo do navegador de repositório, apontando para o URL da cópia de trabalho dada pelo /path ou o /path aponta directamente para um URL.

Uma opção adicional /rev:xxx pode ser usada para especificar a revisão que será mostrada no navegador de repositório. Se a opção /rev:xxx for omitida, será usada a HEAD por defeito.

Se /path apontar para um URL, a /projectpropertiespath:path/to/wc especifica o caminho de onde ler e usar as propriedades de projecto.

Se for especificada a /outfile:path o\file, o URL seleccionado e o número de revisão são escritos para esse ficheiro, quando o navegador de repositório for fechado. A primeira linha nesse ficheiro de texto contém o URL, a segunda linha a revisão no formato de texto.

:ignoreAdds all targets in /path to the ignore list, i.e. adds the svn:ignore property to those files.

Opens the blame dialog for the file specified in /path.

If the options /startrev and /endrev are set, then the dialog asking for the blame range is not shown but the revision values of those options are used instead.

If the option /line:nnn is set, TortoiseBlame will open with the specified line number showing.

The options /ignoreeol, /ignorespaces and /ignoreallspaces are also supported.

:catSaves a file from an URL or working copy path given in /path to the location given in /savepath:caminho. The revision is given in /revision:xxx. This can be used to get a file with a specific revision.
:createpatchCreates a patch file for the path given in /path. To skip the file Save-As dialog you can pass /savepath:caminho 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.

Mostra o gráfico de revisões para o caminho informado em /path.

Para criar um ficheiro de imagem do gráfico de revisão para um caminho específico, mas sem mostrar a janela do gráfico, /output:path com o caminho para o ficheiro de saída. O ficheiro de saída deve ter uma extensão que o gráfico de revisão possa exportar. São suportados os formatos: .svg, .wmf, .png, .jpg, .bmp and .gif.

Visto o gráfico de revisões ter muitas opções que afectam o modo como é visualizado, podes também activar opções para usares ao criar o ficheiro de imagem de saída. Passa essas opções com /options:XXXX, onde XXXX é um valor decimal. A melhor forma para encontrares as opções requeridas é arrancar o gráfico de revisões do modo usual, colocar todas as opções do interface gráfico e fechar o gráfico. Agora as opções que necessitas de passar na linha de comandos podem ser lidas a partir do registo HKCU\Software\TortoiseSVN\RevisionGraphOptions.

:lockLocks 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.
:unlockdestrava um ou todos os arquivos em dado diretório /path.
:rebuildiconcacheRebuilds 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.

Mosta a caixa de diálogo propriedades para o caminho especificado por /path.

Para este comando lidar com propreidades versionadas é necessário uma cópia de trabalho.

As propriedades da revisão podem ser vistas/alteradas se /path for um URL e for especificado /rev:XXX .

Para abrir directamente a caixa de diálogo de propriedades para uma propriedade específica, passa o seu nome como /property:name.


Exports/imports settings, either depending on whether the current settings or the exported settings are newer, or as specified.

If a path is passed with /path, then the path is used to store or read the settings from.

The parameter /askforpath will show a file open/save dialog for the user to chose the export/import path.

If neither /load nor /save is specified, then TortoiseSVN determines whether to export or import the settings by looking at which ones are more recent. If the export file is more recent than the current settings, then the settings are loaded from the file. If the current settings are more recent, then the settings are exported to the settings file.

If /load is specified, the settings are imported from the settings file.

If /save is specified, the current settings are exported to the settings file.

The parameter /local forces a settings export to include local settings, i.e. settings that refer to local paths.

Examples (which should be entered on one line):

TortoiseProc.exe /command:commit
                 /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

TortoiseSVN homepage