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).
Important
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.
D.1.TortoiseSVN Commands
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.
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.
TortoiseSVN uses temporary files to pass multiple arguments between the shell extension and the main program. From TortoiseSVN 1.5.0 on and later, /notempfile parameter is obsolete and there is no need to add it anymore.
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 don't close the dialog automatically
/closeonend:1 auto close if no errors
/closeonend:2 auto close if no errors and conflicts
/closeonend:3 auto close if no errors, conflicts and merges
/closeonend:4 auto close if no errors, conflicts and merges for local operations
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.
List of available commands and options
Command
Description
:about
Shows the about dialog. This is also shown if no command is given.
:log
Opens the log dialog. The /path specifies the file or folder for which the log should be shown. Three additional options can be set: /startrev:xxx, /endrev:xxx and /strict
:checkout
Opens the checkout dialog. The /path specifies the target directory and the /url specifies the URL to checkout from.
:import
Opens the import dialog. The /path specifies the directory with the data to import.
: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 and /ignoreexternals.
:commit
Opens 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:path, where path 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:"the bug id here" to do that.
:add
Adds the files in /path to version control.
:revert
Reverts local modifications of a working copy. The /path tells which items to revert.
:cleanup
Cleans up interrupted or aborted operations and unlocks the working copy in /path.
:resolve
Marks 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.
:repocreate
Creates a repository in /path
:switch
Opens the switch dialog. The /path specifies the target directory.
: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.
:merge
Opens the merge dialog. The /path specifies the target directory. For merging a revision range, the following options are available: /fromurl:URL, /revrange:string. For merging two repository trees, the following options are available: /fromurl:URL, /tourl:URL, /fromrev:xxx and /torev:xxx. These pre-fill the relevant fields in the merge dialog.
:mergeall
Opens the merge all dialog. The /path specifies the target directory.
:copy
Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target URL. You can also specify the /logmsg switch to pass a predefined log message to the branch/tag dialog. Or, if you don't want to pass the log message on the command line, use /logmsgfile:path, where path points to a file containing the log message.
:settings
Opens the settings dialog.
:remove
Removes the file(s) in /path from version control.
:rename
Renames 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.
:diff
Starts the external diff program specified in the TortoiseSVN settings. The /path specifies the first file. If the option /path2 is set, then the diff program is started with those two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. To explicitly set the revision numbers use /startrev:xxx and /endrev:xxx. If /blame is set and /path2 is not set, then the diff is done by first blaming the files with the given revisions.
:showcompare
Depending on the URLs and revisions to compare, this either shows a unified diff (if the option 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.
:conflicteditor
Starts the conflict editor specified in the TortoiseSVN settings with the correct files for the conflicted file in /path.
:relocate
Opens the relocate dialog. The /path specifies the working copy path to relocate.
:help
Opens the help file.
:repostatus
Opens the check-for-modifications dialog. The /path specifies the working copy directory.
:repobrowser
Starts the repository browser dialog, pointing to the URL of the working copy given in /path or /path points directly to an URL. An additional option /rev:xxx can be used to specify the revision which the repository browser should show. If the /rev:xxx is omitted, it defaults to HEAD. If /path points to an URL, the /projectpropertiespath:path/to/wc specifies the path from where to read and use the project properties.
:ignore
Adds all targets in /path to the ignore list, i.e. adds the svn:ignore property to those files.
:blame
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.
:cat
Saves a file from an URL or working copy path given in /path to the location given in /savepath:path. The revision is given in /revision:xxx. This can be used to get a file with a specific revision.
:createpatch
Creates a patch file for the path given in /path.
:revisiongraph
Shows the revision graph for the path given in /path.
:lock
Locks a file or all files in a directory given in /path. The 'lock' dialog is shown so the user can enter a comment for the lock.
:unlock
Unlocks a file or all files in a directory given in /path.
:rebuildiconcache
Rebuilds the windows icon cache. Only use this in case the windows icons are corrupted. A side effect of this (which can't be avoided) is that the icons on the desktop get rearranged. To suppress the message box, pass /noquestion.
:properties
Shows the properties dialog for the path given in /path.
그리고 그전에도 계속 사용하게 되었던 계기중에 하나가 토탈커맨더는 실행환경을 그다지 타지 않기 때문이라고 본다.
즉 쉽게말해 Copy & Run 이 가능하다는 소리..
예전에 Windows 3.x 시절엔 Wincmd.exe 를 쉘로 해놓고 써도 무방할 정도였으니 말이다.. (지금은 explorer.exe 가 메인 쉘이지만..)
어쨋던 토커를 사용하면서 두가지만 알아두면 포터블로 사용하는데 전혀 문제가 없다..
아래 두가지를 확인해보자..
1. Ini 파일
ini 파일은 크게 두개가 젤 중요하다.
하나는 WINCMD.INI 또하나는 WCX_FTP.INI 이다.
플러그인이나 기타의 ini 파일이 더 있을수 있지만 wincmd.ini 파일이 제일 중요하다고 볼수있다.
그럼 문제는 이 ini 파일을 어디에서 읽어올까? 하는것이다.
아래의 레지스트리 내용을 보자
필자는 위의 레지스트리 내용을 wincmdini.reg 파일로 저장해놓고 토커실행전에 한번 등록을 해주고 사용한다. 물론 포터블이라면 이동시 이런걸 등록해주는 것 자체가 귀찮은 일이지만 주로 쓰는 데스크탑에서는 이렇게 등록을 해서 사용한다.
- 또하나의 방법은 bat 파일로 기동시키는것..
totalcmd.exe 는실행 파라메터 지정이 가능하다.
_tc.bat 파일을 만들어서 아래의 한줄을 넣고 _tc.bat로 실행을 시키면 된다. start TOTALCMD.EXE /I=.\wincmd.ini /F=.\wcx_ftp.ini
이것으로 ini를 불러오는 문제는 해결...
2. 환경변수
그다음에 확인할것이 버튼바나 메뉴등에서 사용하는 어플리케이션의 경로문제다.
USB 에 복사해서 사용하다보면 USB를 꼽는 시스템마다 드라이브레터가 변경되고 그렇다면 등록해둔 버튼바나 메뉴가 정상적으로 동작을 하지 않는다..
그래서 토커개발자는 환경변수를 토커실행시 등록하고 종료시 해제하는 기능을 넣어 두었다.
토커 실행전에 명령프롬프트에서 set 을 쳐보면 등록된 환경변수가 나타난다.
그러나 토커에 관련된것은 없다.
토커 실행후 다시 set을 실행하면
COMMANDER_DRIVE
COMMANDER_INI
COMMANDER_PATH
의 3가지 환경변수가 추가되어있는것을 알수 있다.
토커폴더 하위에 program/myapp.exe 라는 것을 가지고 있다면 명령 등록시
%COMMAND_PATH%/program/myapp.exe 라고 지정해두면
어떤 드라이브 레터를 받아도 구동이 가능하다.
마찬가지로 토커가 실행된 드라이브 레터를 알기위해선 %COMMAND_DRIVE% 로 이용할수 있다.