1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ifchange.bat: --keep option

* win32/ifchange.bat: add --keep option as well as tool/ifchange.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-10-16 14:39:53 +00:00
parent 8565a1b502
commit d7144025fd

View file

@ -2,6 +2,7 @@
:: usage: ifchange target temporary :: usage: ifchange target temporary
set timestamp= set timestamp=
set keepsuffix=
:optloop :optloop
for %%I in (%1) do set opt=%%~I for %%I in (%1) do set opt=%%~I
if "%opt%" == "--timestamp" ( if "%opt%" == "--timestamp" (
@ -12,6 +13,14 @@ if "%opt%" == "--timestamp" (
set timestamp=%opt:~12% set timestamp=%opt:~12%
shift shift
goto :optloop goto :optloop
) else if "%opt%" == "--keep" (
set keepsuffix=.old
shift
goto :optloop
) else if "%opt:~0,7%" == "--keep=" (
set keepsuffix=%opt:~7%
shift
goto :optloop
) )
if "%opt%" == "" goto :end if "%opt%" == "" goto :end
@ -51,6 +60,7 @@ echo assuming %1 should be changed.
echo %1 updated. echo %1 updated.
:: if exist %1 del %1 :: if exist %1 del %1
dir /b %2 dir /b %2
if "%keepsuffix%" != "" %1 %1%keepsuffix%
copy %2 %1 copy %2 %1
del %2 del %2
goto :end goto :end