본문 바로가기

파워컴퓨팅/유틸리티 활용

토탈 커맨더와 거북이 SVN의 조합.

 

SVN을 처음 사용했을 때 Tortoise SVN을 사용했었다.

SVN 클라이언트에 대한 개념도 그다지 없었고 그냥 쓰게 된 것이 SVN을 처음 접해본 것이었다.

그러나 한가지 문제는 이 프로그램은 탐색기에 통합된 버전으로 설치하고 나면 상시 모니터가 상주하며(TSVNCache.exe)

시간이 흐를수록 이 상주된 프로그램이 뭔 짓거리를 하는지 점점 시스템 리소스를 깎아 먹는다.

필자는 큰 이유 없이 램에 상주하는 프로그램을 아주 매운데 뜨겁기까지 한 음식 만큼이나 싫어 한다.

특히 인터넷 뱅킹 좀 하려고 하면 서비스 형태로 깔리는 프로그램은 더욱 싫어한다.

 

예전에는 (SVN 1.4.xx 대) 거북이 SVN 이 독립된 형태로 실행이 불가능 하였던 걸로 기억이 된다.

최근 프로그램을 다시 받아서 테스트해보니 독립된 형태로 무척 잘 돌아가는 것을 확인하였다.

 

각설하고.. 가상컴퓨터에 거북이 SVN과 한글 언어팩을 설치한 후 Program Files 폴더아래 TortoiseSVN 폴더를 임의의 폴더에 통채로 복사해 놓는다.

 

 

복사가 끝났으면 토탈커맨더에서 제공하는 기능중 버튼바에 필요한 기능을 추가하여 프로그램을 실행시키면 된다.

새로운 버튼바를 생성하고 파라메터, 표시명칭을 입력해주면 된다.

 

새로 만드는것 조차 번거롭기 때문에 아래의 텍스트를 복사해서 Tortoise.bar 로 저장후 편집기로 각자의 경로에 맞는 부분을 수정하여 사용해도 된다.

아래의 내용중  %COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe 라고 되어있는 부분을

각자의 경로로 변경한 후 버튼바로 등록하여 사용하면 된다.

 

[Buttonbar]
Buttoncount=36
button1=wcmicons.dll,15
cmd1=%COMMANDER_PATH%\ButtonBar\default.bar
iconic1=0
button2=
iconic2=0
button3=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
cmd3=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
path3=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic3=0
menu3=TortoiseProc
button4=
iconic4=0
button5=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,2
cmd5=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param5=/command:checkout /path:"%P"
path5=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic5=0
menu5=체크아웃
button6=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,22
cmd6=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param6=/command:relocate /path:"%P"
path6=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic6=0
menu6=리로케이트(저장소URL변경)
button7=
iconic7=0
button8=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,99
cmd8=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param8=/command:repobrowser /path:"%P"
path8=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic8=0
menu8=저장소 브라우저
button9=
iconic9=0
button10=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,3
cmd10=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param10=/command:update /path:"%P" /closeonend:0
path10=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic10=0
menu10=업데이트
button11=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,4
cmd11=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param11=TortoiseProc.exe /command:commit /path:"%P" /logmsg:"토커에서 커밋" /closeonend:0
path11=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic11=0
menu11=커밋
button12=
iconic12=0
button13=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,24
cmd13=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param13=/command:repostatus /path:"%P"
path13=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic13=0
menu13=수정파일 체크
button14=
iconic14=0
button15=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,17
cmd15=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param15=/command:log /path:"%P"
path15=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic15=0
menu15=로그 보기
button16=
iconic16=0
button17=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,17
cmd17=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param17=/command:properties /pathfil%COMMANDER_DRIVE%"%P%N" /deletepathfile
path17=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic17=0
menu17=속성
button18=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd18=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param18=/command:cleanup /path:"%P"
path18=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic18=0
menu18=클린업
button19=
iconic19=0
button20=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,13
cmd20=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param20=/command:copy /path:"%P"
path20=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic20=0
menu20=복사(브랜치/태그생성)
button21=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,9
cmd21=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param21=/command:switch /path:"%P"
path21=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic21=0
menu21=스위치(브랜치/태그전환)
button22=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,5
cmd22=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param22=/command:add /path:"%P%N"
path22=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic22=0
menu22=추가
button23=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,6
cmd23=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param23=/command:revert /path:"%P"
path23=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic23=0
menu23=되돌리기
button24=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,14
cmd24=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param24=/command:remove /path:"%P%N"
path24=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic24=0
menu24=리무브
button25=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,15
cmd25=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param25=/command:rename /path:"%P%N"
path25=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic25=0
menu25=이름바꾸기
button26=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,61
cmd26=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param26=/command:blame /path:"%P%N"
path26=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic26=0
menu26=블레임(변경한사람보기)
button27=
iconic27=0
button28=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,19
cmd28=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param28=/command:settings
path28=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin
iconic28=0
menu28=환경설정
button29=
iconic29=0
button30=
iconic30=0
button31=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd31=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param31=/command:cleanup /path:"%P"
path31=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic31=0
menu31=예비
button32=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd32=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param32=/command:cleanup /path:"%P"
path32=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic32=0
menu32=예비
button33=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd33=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param33=/command:cleanup /path:"%P"
path33=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic33=0
menu33=예비
button34=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd34=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param34=/command:cleanup /path:"%P"
path34=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic34=0
menu34=예비
button35=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd35=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param35=/command:cleanup /path:"%P"
path35=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic35=0
menu35=예비
button36=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe,7
cmd36=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\TortoiseProc.exe
param36=/command:cleanup /path:"%P"
path36=%COMMANDER_DRIVE%\Win-Dev\Svn\TortoiseSVN\bin\
iconic36=0
menu36=예비

 

그리고 버튼바를 메뉴타입으로 등록하면 더욱 사용하기 편리하다.

 

실제 사용은 토탈커맨더로 svn저장소파일이 있는곳으로 이동하여 해당 기능을 수행하면 현재 토커에 표시된 경로를 기준으로 기능이 동작한다.

가령 e:\Source\bulker\Common\  폴더에 커밋하거나 업데이트 할 데이터가 있다면 그곳으로 이동후 해당 기능을 이용하면 된다.

 

Tortoise.bar 파일의 내용을 보면 알수 있듯이 TortoiseProc.exe 가 주요 기능을 다 가지고 있으며 실행파라메터에따라 각각의 기능을 수행하도록 되어있다.

 

굳이 토탈커맨더가 아니라 별도의 래퍼프로그램을 배치파일이나 간단한 스크립트 언어로도 제작하여 활용이 가능하다.

거북이 SVN의 도움말을 보면 아래의 내용이 나와있으니 참고하여 만들면 되겠다.

 

처음에 실행시 UI가 영문으로 나올경우 환경설정메뉴를 통해서 한글로 바꿔주면 이후에는 한글로 UI가 표시된다.


Automating TortoiseSVN

Table of Contents

D.1. TortoiseSVN Commands
D.2. TortoiseIDiff Commands

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.


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