1,查看svn差异文件列表命令
打开命令行工具,转到工程svn所在目录,然后执行以下命令。
svn status (stat, st)即:svn status是全名,svn stat 或 svn st是简写。
那么使用
svn st > status.txt
就可以把差异文件列表,输出到status.txt文件。
当然检查修改文件列表也可以用图形界面作,就是copy到文件有些费事。
2,下面就是处理status.txt文件的命令,可以把添加的文件和修改的文件copy到指定目录
其中,第一个参数为svn st导出的文件名(如status.txt),第二个参数为导出文件的目的目录(如"..\diff"表示导出到上级目录的diff文件夹下)
在工程svn所在目录,创建文件: svn_copy_diff.bat,复制粘贴下面代码,
然后执行命令:svn_copy_diff status.txt ..\diff
@echo off&setlocal EnableDelayedExpansion&setlocal EnableExtensions
rem diff_paths_file: svn status file
set diff_paths_file=%1
if "%diff_paths_file%"=="" (
svn st > status.txt
set diff_paths_file=status.txt
)
if not exist "%diff_paths_file%" (
@echo "%diff_paths_file% does not exist!"
@echo "please set name of file diff_path.txt, which contains different files' paths!"
goto finish
)
rem back_path: the dir where to put the diff files
set back_path=%2
if "%back_path%"=="" (
set back_path=..\..\diff
)
rem delete dir: not need
rem rd /s /q %back_path%
if not exist "%back_path%" (
md %back_path%
)
rem delete old diff_paths_file
del %back_path%\%diff_paths_file%
@echo "The destination path is %back_path%"
@echo "Now begin copying ..."
@echo/
rem loop copy
for /f "delims=" %%a in ('type %diff_paths_file%') do (
set "filepath=%%a"
set "filepath=!filepath:~8!"
rem @echo !filepath!
rem pause
if not "!filepath!"=="." (
call :LastIndex !filepath! \ idx
rem echo !idx!
call :SubString !filepath! 0 !idx! dir_str
rem echo !dir_str!
rem echo %back_path%\!dir_str!
if not exist "%back_path%\!dir_str!" (
md %back_path%\!dir_str!
)
@echo copy !filepath! %back_path%\!dir_str!
rem pause
rem copy !filepath! %back_path%
copy !filepath! %back_path%\!dir_str!
)
)
rem copy diff_paths_file into back_path
@echo copy %diff_paths_file% %back_path%
copy %diff_paths_file% %back_path%
rem finish
pause
goto finish
rem the string method to calculate one string length
:Strlen %src_str% len
setlocal EnableExtensions
set num=0
set str_tmp=%1
:next1
if not "%str_tmp%"=="" (
set /a num+=1
set "str_tmp=%str_tmp:~1%"
goto next1
)
set len=%num%
endlocal & set "%2=%num%"
goto :EOF
rem the string method to find the last occurence of specific char
:LastIndex %src_str% %char% index
setlocal EnableExtensions
set len=0
call :Strlen %1 len
rem echo %len%
set target_ch=%2
set str_tmp=%1
:next
if not "%str_tmp%"=="" (
rem check the fisrt char of this string
if "!str_tmp:~-1!"=="%target_ch%" goto last
rem get remaining string
set /a len-=1
set "str_tmp=%str_tmp:~0,-1%"
goto next
)
set /a len=0
:last
endlocal & set %3=%len%
goto :EOF
rem the string method to cut substring
rem this is to use in the scope of DelayedExpansion, that statement is combined with '!' char
:SubString %src_str% %start_pos% %end% result
setlocal EnableExtensions
set str_tmp=%1
set str_tmp=!str_tmp:~%2,%3!
endlocal & set %4=%str_tmp%
goto :EOF
:finish