关于SVN的操作批处理示例
2012-02-10 17:14
218 查看
为了一句话:不要动手做机器能够做的事情.
天天工作用svn,更新啥的打开目录啥的动作天天在重复.每次写些命令也蛮无聊的,不说了,看下面:
这中间是随便写了几个操作,可根据实际需要自行增减,代码行应该可以精简,哪位同学闲来无事的可以试试
附svn的一些命令行说明
另外:
示例:
OK...
天天工作用svn,更新啥的打开目录啥的动作天天在重复.每次写些命令也蛮无聊的,不说了,看下面:
@echo off rem 显示部分 @echo 注 意 事 项 @echo ************************************************************************ @echo 可以精简并通过计划任务来制定自动执行,运行前请检查下面目录: @echo. @echo 1.svn_bin 为安装TortoiseSVN客户端的可执行程序目录 @echo 2.svn_work 为更新项目文件的目录 @echo. @echo WIN7或WINVista或WIN2008的用户请用管理员身份运行 @echo ************************************************************************ rem 路径变量,请在此处按实际修改,最后面不要带斜杠 @set svn_bin=D:\Program Files\TortoiseSVN\bin @set svn_work=E:\SVN rem 判断可执行文件及项目文件目录是否正确 @if not exist "%svn_bin%\TortoiseProc.exe" ( echo. echo error: 请确认TortoiseSVN客户端目录正确? echo 目前定义的是:%svn_bin% echo. pause & exit 1 ) if not exist "%svn_work%\.svn" ( echo. echo error: 请确认SVN项目文件目录正确? echo 目前定义的是:%svn_bin% echo. pause & exit 2 ) rem 显示操作菜单 :menu echo. echo ☆☆☆请选择数字后按回车☆☆☆ echo. echo 1.SVN全目录更新 echo. echo 2.打开某某项目SVN(QA专用) echo. echo 3.打开某某项目网站SVN (QA专用) echo. echo 4.SVN全目录日志 echo. echo 0.退出 echo. set choice= set /p choice=请选择对应数字输入: if not "%choice%"=="" choice=%choice:~0,1% if /i "%choice%"=="1" goto start1 if /i "%choice%"=="2" goto start2 if /i "%choice%"=="3" goto start3 if /i "%choice%"=="4" goto start4 if /i "%choice%"=="0" goto exit echo 选择无效,请重新输入... echo. goto :menu :start1 cls echo SVN目录更新 echo. rem 更新snv "%svn_bin%"\TortoiseProc.exe/command:update /path:"%svn_work%" /notempfile /closeonend:4 echo 已完成,返回主菜单 goto :menu :start2 cls echo 打开SVN某某项目目录 echo. rem 打开某某项目,固定写死 explorer /e,"%svn_work%\Testing\Videocomm" goto :menu :start3 cls echo 打开SVN某某项目网站目录 echo. explorer /e,"%svn_work%\Testing\Trunk\" goto :menu :start4 cls echo 打开SVN全目录日志 echo. "%svn_bin%"\TortoiseProc.exe/command:log /path:"%svn_work%" /notempfile /closeonend:0 goto :menu
这中间是随便写了几个操作,可根据实际需要自行增减,代码行应该可以精简,哪位同学闲来无事的可以试试
附svn的一些命令行说明
命令 | 描述 |
---|---|
:about | 显示关于对话框。如果没有给命令也会显示。 |
:log | 打开日志对话框,/path指定了显示日志的文件或目录,另外还有三个选项可以设置: /startrev:xxx、 /endrev:xxx和 /strict |
:checkout | 打开检出对话框,/path指定了目标路径,而 /url制定了检出的URL。 |
:import | 打开导入对话框,/path指定了数据导入路径。 |
:update | 将工作副本的/path更新到HEAD,如果给定参数 /rev,就会弹出一个对话框询问用户需要更新到哪个修订版本。为了防止指定修订版本号 /rev:1234的对话框,需要选项 /nonrecursive和 /ignoreexternals。 |
:commit | 打开提交对话框,/path指定了目标路径或需要提交的文件列表,你也可以使用参数 /logmsg给提交窗口传递预定义的日志信息,或者你不希望将日志传递给命令行,你也可以使用 /logmsgfile:path, path指向了保存日志信息的文件。为了预先填入bug的ID(如果你设置了集成bug追踪属性),你可以使用 /bugid:"the bug id here"完成这个任务。 |
:add | 将/path的文件添加到版本控制 。 |
:revert | 恢复工作副本的本地修改,/path说明恢复哪些条目。 |
:cleanup | 清理中断和终止的操作,将工作副本的/path解锁。 |
:resolve | 将/path指定文件的冲突标示为解决,如果给定 /noquestion,解决不会向用户确认操作。 |
:repocreate | 在/path创建一个版本库。 |
:switch | 打开选项对话框。/path指定目标目录。 |
:export | 将/path的工作副本导出到另一个目录,如果 /path指向另一个未版本控制目录,对话框会询问要导出到 /path的URL。 |
:merge | Opens the merge dialog. The /pathspecifies 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:xxxand /torev:xxx. These pre-fill the relevant fields in the merge dialog. |
:mergeall | Opens the merge all dialog. The /pathspecifies the target directory. |
:copy | Brings up the branch/tag dialog. The /pathis the working copy to branch/tag from. And the /urlis the target URL. You can also specify the /logmsgswitch 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 /pathspecifies the first file. If the option /path2is set, then the diff program is started with those two files. If /path2is omitted, then the diff is done between the file in /pathand its BASE. To explicitly set the revision numbers use /startrev:xxxand /endrev:xxx. If /blameis set and /path2is 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 unifiedis 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, revision1and revision2must be specified. The options pegrevision, ignoreancestry, blameand unifiedare 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指定了工作副本目录。 |
:repobrowser | Starts the repository browser dialog, pointing to the URL of the working copy given in /pathor /pathpoints directly to an URL. An additional option /rev:xxxcan be used to specify the revision which the repository browser should show. If the /rev:xxxis omitted, it defaults to HEAD. If /pathpoints to an URL, the /projectpropertiespath:path/to/wcspecifies the path from where to read and use the project properties. |
:ignore | 将/path中的对象加入到忽略列表,也就是将这些文件添加到 svn:ignore属性。 |
:blame | 为 /path选项指定的文件打开追溯对话框。 如果设置了 /startrev和 /endrev选项,不会显示询问追溯范围对话框,直接使用这些选项中的版本号。 如果设置了 /line:nnn选项,TortoiseBlame 会显示指定行数。 也支持 /ignoreeol, /ignorespaces和 /ignoreallspaces选项。 |
:cat | 将/path指定的工作副本或URL的文件保存到 /savepath:path,修订版本号在 /revision:xxx,这样可以得到特定修订版本的文件。 |
:createpatch | 创建/path下的补丁文件。 |
:revisiongraph | 显示/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 | 显示 /path给出的路径之属性对话框。 |
如果想在进度对话框执行完毕后自动关闭,而又不必设置永久性的参数,可以传递/closeonend参数。 /closeonend:0 不自动关闭对话框 /closeonend:1 如果没发生错误则自动关闭对话框 /closeonend:2 如果没发生错误和冲突则自动关闭对话框 /closeonend:3如果没有错误、冲突和合并,会自动关闭 /closeonend:4如果没有错误、冲突和合并,会自动关闭 下面的列表列出了所有可以使用TortoiseProc.exe访问的命令,就像上面的描述,必须使用/command:abcd的形式,在列表中,因为节省空间的关系省略了/command的前缀。
示例:
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
OK...
相关文章推荐
- 关于SVN的操作批处理示例
- [转]关于SVN的操作批处理示例
- phoenixframework自动化测试平台对svn服务器操作示例
- 操作系统中关于信号量操作的代码示例(Linux + windows)
- .NET关于操作进程的简单示例
- 关于Android Studio 使用SVN进行 项目回滚操作
- 操作系统中关于信号量操作的代码示例(Linux + windows)
- SVN学习笔记10 -- Eclipse中关于SVN 的相关操作
- .NET关于操作进程的简单示例
- c#:SharpSvn关于SVN操作
- 一个关于php操作svn的功能类
- 关于SVN:合并提交是如何操作的?
- 关于tlistView 的操作示例
- C语言一个关于文件操作的示例
- .NET关于操作进程的简单示例
- .NET关于操作进程的简单示例
- .NET关于操作进程的简单示例
- 关于SVN 操作 提示文件已过时,请先update
- 关于STM32的FLASH操作【摘】
- 9. MyEclipse中的SVN操作手册