关于SVN的操作批处理示例
关于SVN的操作批处理示例
为了一句话:不要动手做机器能够做的事情.
天天工作用svn,更新啥的打开目录啥的动作天天在重复.每次写些命令也蛮无聊的,不说了,看下面:

1 @echo off
2 rem 显示部分
3 @echo 注 意 事 项
4 @echo ************************************************************************
5 @echo 可以精简并通过计划任务来制定自动执行,运行前请检查下面目录:
6 @echo.
7 @echo 1.svn_bin 为安装TortoiseSVN客户端的可执行程序目录
8 @echo 2.svn_work 为更新项目文件的目录
9 @echo.
10 @echo WIN7或WINVista或WIN2008的用户请用管理员身份运行
11 @echo ************************************************************************
12
13 rem 路径变量,请在此处按实际修改,最后面不要带斜杠
14 @set svn_bin=D:\Program Files\TortoiseSVN\bin
15 @set svn_work=E:\SVN
16
17 rem 判断可执行文件及项目文件目录是否正确
18 @if not exist "%svn_bin%\TortoiseProc.exe" (
19 echo.
20 echo error: 请确认TortoiseSVN客户端目录正确?
21 echo 目前定义的是:%svn_bin%
22 echo.
23 pause & exit 1
24 )
25 if not exist "%svn_work%\.svn" (
26 echo.
27 echo error: 请确认SVN项目文件目录正确?
28 echo 目前定义的是:%svn_bin%
29 echo.
30 pause & exit 2
31 )
32
33 rem 显示操作菜单
34 :menu
35 echo.
36 echo ☆☆☆请选择数字后按回车☆☆☆
37 echo.
38 echo 1.SVN全目录更新
39 echo.
40 echo 2.打开某某项目SVN(QA专用)
41 echo.
42 echo 3.打开某某项目网站SVN (QA专用)
43 echo.
44 echo 4.SVN全目录日志
45 echo.
46 echo 0.退出
47 echo.
48 set choice=
49 set /p choice=请选择对应数字输入:
50 if not "%choice%"=="" choice=%choice:~0,1%
51 if /i "%choice%"=="1" goto start1
52 if /i "%choice%"=="2" goto start2
53 if /i "%choice%"=="3" goto start3
54 if /i "%choice%"=="4" goto start4
55 if /i "%choice%"=="0" goto exit
56 echo 选择无效,请重新输入...
57 echo.
58 goto :menu
59
60 :start1
61 cls
62 echo SVN目录更新
63 echo.
64 rem 更新snv
65 "%svn_bin%"\TortoiseProc.exe/command:update /path:"%svn_work%" /notempfile /closeonend:4
66 echo 已完成,返回主菜单
67 goto :menu
68
69 :start2
70 cls
71 echo 打开SVN某某项目目录
72 echo.
73 rem 打开某某项目,固定写死
74 explorer /e,"%svn_work%\Testing\Videocomm"
75 goto :menu
76
77 :start3
78 cls
79 echo 打开SVN某某项目网站目录
80 echo.
81 explorer /e,"%svn_work%\Testing\Trunk\"
82 goto :menu
83
84 :start4
85 cls
86 echo 打开SVN全目录日志
87 echo.
88 "%svn_bin%"\TortoiseProc.exe/command:log /path:"%svn_work%" /notempfile /closeonend:0
89 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 /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
打开设置对话框。
: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. 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
打开重定位对话框,/path指定了重定位的工作副本路径。
:help
打开帮助文件
:repostatus
打开为修改检出对话框,/path 指定了工作副本目录。
: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
将/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 给出的路径之属性对话框。
另外:

1 如果想在进度对话框执行完毕后自动关闭,而又不必设置永久性的参数,可以传递/closeonend参数。
2 /closeonend:0 不自动关闭对话框
3 /closeonend:1 如果没发生错误则自动关闭对话框
4 /closeonend:2 如果没发生错误和冲突则自动关闭对话框
5 /closeonend:3如果没有错误、冲突和合并,会自动关闭
6 /closeonend:4如果没有错误、冲突和合并,会自动关闭
7 下面的列表列出了所有可以使用TortoiseProc.exe访问的命令,就像上面的描述,必须使用/command:abcd的形式,在列表中,因为节省空间的关系省略了/command的前缀。

示例:

1 Examples (which should be entered on one line):
2 TortoiseProc.exe /command:commit
3 /path:"c:\svn_wc\file1.txt*c:\svn_wc\file2.txt"
4 /logmsg:"test log message" /closeonend:0
5
6 TortoiseProc.exe /command:update /path:"c:\svn_wc\" /closeonend:0
7
8 TortoiseProc.exe /command:log /path:"c:\svn_wc\file1.txt"
9 /startrev:50 /endrev:60 /closeonend:0

关于SVN的操作批处理示例的更多相关文章
- [转]关于SVN的操作批处理示例
为了一句话:不要动手做机器能够做的事情. 天天工作用svn,更新啥的打开目录啥的动作天天在重复.每次写些命令也蛮无聊的,不说了,看下面: @echo off rem 显示部分 @echo 注 意 事 ...
- SVN客户端操作
版权声明:本文为博主原创文章,转载请注明原文出处. https://blog.csdn.net/zzfenglin/article/details/50937119 下面我们来了解一下SVN客户端 ...
- SVN基础操作
SVN基础操作 安装 #大多数Linux版本自带svn svn --version #如果没有安装可用yum安装 yum install subversion 生命周期 创建版本库 检出 更新 执行变 ...
- Python操作SQLServer示例(转)
转自:http://www.cnblogs.com/lrzy/p/4346781.html 本文主要是Python操作SQLServer示例,包括执行查询及更新操作(写入中文). 需要注意的是:读取数 ...
- 转:Python操作SQLServer示例
注:此文也是转载,2018年1月发现此文阅读量过万,略感不安.当时只是为了自己存档学习,未粘此文的原始连接.如有侵权,通过即删除,敬请谅解! 从网上找的,估计原文是:Python操作SQLServer ...
- C#操作MSMQ示例
C#操作MSMQ示例,示例代码: using System; using System.Collections.Generic; using System.Linq; using System.Tex ...
- Python操作SQLServer示例
本文主要是Python操作SQLServer示例,包括执行查询及更新操作(写入中文). 需要注意的是:读取数据的时候需要decode('utf-8'),写数据的时候需要encode('utf-8'), ...
- springLdap 操作ldap示例(增删改查)
转自:http://blog.csdn.net/sundenskyqq/article/details/9002440 这部分的示例网上的确有很多,但是个人在查找的过程中还是感到不够满意,所以就自己总 ...
- Linux下 svn相关操作
Linux下 svn相关操作 一.首先看看svn安装的位置: 命令: find / -name svn /var/svn :表示安装目录 /user/bin/svn :表示命令目录 可以看到的是svn ...
随机推荐
- Java基础知识强化之集合框架笔记46:Set集合之TreeSet存储自定义对象并遍历练习2(自然排序:Comparable)
1. TreeSet存储自定义对象并遍历练习2: (1)Student.java package cn.itcast_06; /* * 如果一个类的元素要想能够进行自然排序,就必须实现自然排序接口 * ...
- centos mysql 编译安装
centos mysql 编译安装 1.安装 创建MySQL用户 sudo useradd mysql 下载MySQL的源码包,我们这里使用的时5.5.18 安装依赖 sudo yum -y inst ...
- junit 测试注解
* @Test: 将一个 普通的方法修饰成为一个测试方法* @BeforeClass: 他会在所有的方法运行前被执行,static修饰* @AfterClass 他会在所有方法运行结束后被执行,sta ...
- 树形dp练习
/*poj 1463 最小点覆盖 匈牙利*/ #include<iostream> #include<cstdio> #include<cstring> #defi ...
- html 新元素
html5新元素 html5语义元素 <header> 定义了文档或者文档的一部分区域的页眉 <nav> 定义了导航链接的部分 <section> 定义了文档的某个 ...
- 用户组,AD域控简介
“自由”的工作组 工作组(WORK GROUP)就是将不同的电脑按功能分别列入不同的组中,以方便管理.比如在一个网络内,可能有成百上千台工作电脑,如果这些电脑不进行分组,都列在“网上邻居”内,可 ...
- phpstrom+xdebug调试PHP代码
众所周知开发PHP的IDE种类繁多,然而开发PHP并不能像开发其他语言一样,调试PHP代码对诸多新手来说,搭建调试环境就比较麻烦!其实哈,我发现NuSphere-phped-16.0很强大,集成了很强 ...
- Core Data 教学
看了一篇国外的文章,关于iOS9的Core Data教学,在这里做了一下总结 Core Data 教学 示例开源地址:LastDayCoreData 在这篇文章中我们将学习Core Data的系列教程 ...
- Objective-C中的分类与协议
分类 在谈分类之前,我们可以先探究下,OC中为什么出现分类这种机制,有什么好处? 假设你接到一个大项目:计算两个整数的和,差.接到任务的你马上动手.编写代码如下: #import <Founda ...
- ios9 http请求失败的问题
最近做项目的时候 将电脑版本升级到10.11.3 xcode'升级到 7.2 但是在模拟器上边进行数据请求的时候告诉我说网路哦有问题 截图如下 通过网络终于找到了解决的办法 原来是ios9 采用 ...