bat脚本svn更新和提交(可直接使⽤)脚本内容
@echo off
CHCP 936
title svn批量更新和提交
@echo ******************************************************
@echo svn批量更新和提交
@echo work_dirs 需要更新的⽬录路径,路径之间⽤空格隔开
@echo *****************************************************
t path_dir=E:\h5\branch\
t on_dir=%path_dir%pack_rver
t work_dirs=%path_dir%rxxx_publish\rver
t curr_dir=%cd%
t log_dir=%curr_dir%\log
t log_file=%log_dir%\%date:~0,4%%date:~5,2%%date:~8,2%.txt
t curr_time=%time:~0,2%:%time:~3,2%:%time:~6,2%
svn update "%on_dir%"
echo "更新源⽬录-----:"%on_dir%
惠崇春江晚景苏轼
echo %curr_time% %%on_dir" 更新源⽬录">> %log_file%
if not exist %log_dir% (
md %log_dir%
)
tlocal enabledelayedexpansion
for %%c in (%work_dirs%) do (
echo !curr_time! %%c" ========开始">> %log_file%
svn update "%%c"
rd /s /Q %%c
md %%c
xcopy %on_dir% %%c /e /q /y
echo "xcopy:"%%c
cd /d %%c
for /f "eol=M tokens=1,2 delims= " %%i in ('svn st') do (
if "%%i" == "?" (
svn add "%%j"
)
el if "%%i" == "A" (
svn add "%%j"
)el if "%%i" == "!" (
svn del "%%j"
)
)
svn commit -m "周期脚本版本合并" "%%c"
t curr_time=!time:~0,2!:!time:~3,2!:!time:~6,2!
echo !curr_time! %%c "完成!!">> %log_file%
echo "完成========:"%%c
)
pau
FOR /F 格式: 详细说明请到查看
FOR /F ["options"] %%i IN (file) DO command
FOR /F ["options"] %%i IN ("string") DO command
FOR /F ["options"] %%i IN ('command') DO command
file代表⼀个或多个⽂件
string 代表字符串
command代表命令
["options"] 可选
注解 for /f参数
1、delims=后⾯的字符的意识是,将⽂本每⼀⾏的内容以delims=后⾯的字符分割成若⼲列.
“delims=, . / " 意思就是把111,222.333 444/555以,./和空格(不分先后)分成了5列.注意代码中/和"后⾯有个空格, 显⽰结果是 111 222 333 444 55512新作
2、tokens=1,2 表⽰当前⾏按delims分割后的第1,2列值,定义 %%a 则第2列为%%b(*表⽰全部列)
3、eol=M 表⽰忽略带M的⾏
cd切换分区⽬录
cd /d path
关于结尾cloonend:1类型解释:
/cloonend:0 不⾃动关闭对话框
/cloonend:1 如果没发⽣错误则⾃动关闭对话框
/cloonend:2 如果没发⽣错误和冲突则⾃动关闭对话框
/cloonend:3如果没有错误、冲突和合并,会⾃动关闭
/cloonend:4如果没有错误、冲突和合并,会⾃动关闭
常见svn命令⾏说明:
命令 描述
1. :about 显⽰关于对话框。如果没有给命令也会显⽰。
2. :log 打开⽇志对话框,/path 指定了显⽰⽇志的⽂件或⽬录,另外还有三个选项可以设置: /startrev:xxx、/endrev:xxx和/strict
3. :checkout 打开检出对话框,/path指定了⽬标路径,⽽/url制定了检出的URL。
4. :import 打开导⼊对话框,/path 指定了数据导⼊路径。
5. :update 将⼯作副本的/path更新到HEAD,如果给定参数/rev,就会弹出⼀个对话框询问⽤户需要更新到哪个修订版本。为了防⽌
指定修订版本号/rev:1234的对话框,需要选项/nonrecursive和/ignoreexternals。
如何编手绳6. :commit 打开提交对话框,/path 指定了⽬标路径或需要提交的⽂件列表,你也可以使⽤参数 /log
msg 给提交窗⼝传递预定义的
⽇志信息,或者你不希望将⽇志传递给命令⾏,你也可以使⽤ /logmsgfile:path,path 指向了保存⽇志信息的⽂件。为了预先填⼊bug的ID(如果你设置了集成bug追踪属性),你可以使⽤/bugid:"the bug id here"完成这个任务。
7. :add 将/path的⽂件添加到版本控制 。
8. :revert 恢复⼯作副本的本地修改,/path说明恢复哪些条⽬。
9. :cleanup 清理中断和终⽌的操作,将⼯作副本的/path解锁。
10. :resolve 将/path指定⽂件的冲突标⽰为解决,如果给定/noquestion,解决不会向⽤户确认操作。
11. :repocreate 在/path创建⼀个版本库。
12. :switch 打开选项对话框。/path 指定⽬标⽬录。
13. :export 将/path的⼯作副本导出到另⼀个⽬录,如果/path指向另⼀个未版本控制⽬录,对话框会询问要导出到/path的URL。
14. :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. The pre-fill the relevant fields in the merge dialog.
15. :mergeall Opens the merge all dialog. The /path specifies the target directory.
16. :copy Brings up the branch/tag dialog. The /path is the working copy to branch/tag from. And the /url is the target
魅蓝eURL. 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, u /logmsgfile:path, where path points to a file containing the log message.
17. :ttings 打开设置对话框。
18. :remove 从版本控制⾥移除/path中的⽂件。
19. :rename 重命名/path的⽂件,会在对话框中询问新⽂件,为了防⽌⼀个步骤中询问相似⽂件,传递/noquestion。
20. :diff Starts the external diff program specified in the TortoiSVN ttings. The /path specifies the first file. If the
手打牛肉丸的做法option /path2 is t, then the diff program is started with tho two files. If /path2 is omitted, then the diff is done between the file in /path and its BASE. To explicitly t the revision numbers u /startrev:xxx and /endrev:xxx.
If /blame is t and /path2 is not t, then the diff is done by first blaming the files with the given revisions.
21. :showcompare
22. Depending on the URLs and revisions to compare, this either shows a unified diff (if the option unified is t), a dialog
with a list of files that have changed or if the URLs point to files starts the diff viewer for tho two files.
23. The options url1, url2, revision1 and revision2 must be specified. The
options pegrevision, ignoreancestry, blame and unified are optional.
解缙
24. :conflicteditor Starts the conflict editor specified in the TortoiSVN ttings with the correct files for the conflicted
file in /path.
25. :relocate 打开重定位对话框,/path指定了重定位的⼯作副本路径。
26. :help 打开帮助⽂件
27. :repostatus 打开为修改检出对话框,/path 指定了⼯作副本⽬录。
28. :repobrowr Starts the repository browr 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 ud to specify the revision which the repository browr 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 u the project properties.
29. :ignore 将/path中的对象加⼊到忽略列表,也就是将这些⽂件添加到 svn:ignore 属性。
30. :blame
31. 为 /path 选项指定的⽂件打开追溯对话框。
32. 如果设置了 /startrev 和 /endrev 选项,不会显⽰询问追溯范围对话框,直接使⽤这些选项中的版本号。
33. 如果设置了 /line:nnn 选项,TortoiBlame 会显⽰指定⾏数。
34. 也⽀持 /ignoreeol,/ignorespaces 和 /ignoreallspaces 选项。
35. :cat 将/path指定的⼯作副本或URL的⽂件保存到/savepath:path,修订版本号在/revision:xxx,这样可以得到特定修订版本的⽂
件。
36. :createpatch 创建/path下的补丁⽂件。
37. :revisiongraph 显⽰/path⽬录下的版本变化图。
38. :lock Locks a file or all files in a directory given in /path. The 'lock' dialog is shown so the ur can enter a comment
雷锋精神
for the lock.
39. :unlock Unlocks a file or all files in a directory given in /path.70岁以上老人意外险
40. :rebuildiconcache Rebuilds the windows icon cache. Only u this in ca 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.
41. :properties 显⽰ /path 给出的路径之属性对话框。