Created
June 18, 2013 12:29
-
-
Save huksley/5804962 to your computer and use it in GitHub Desktop.
Make incremental subversion repo dump, reading previous state from dump log and making new incremental file on each invocation. Please note, this Win32 bat file requires some tools from gnuwin32 project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Makes incremental dump, reading previous state from dump log | |
set REPO=%1 | |
set LOG=%~n1.log | |
set DUMPBASE=%~n1 | |
set REV= | |
if "%REPO%"=="" echo Usage: %0 ^<repo^> && goto exit | |
if not exist %LOG% echo Starting from beginning of repo && set REV=1&& goto dump | |
echo Reading latest dumped revision from %LOG% | |
grep "Dumped revision" %LOG% | cut -d" " -f4 | cut -d"." -f1 | sed -re "s/^/set \/a REV=1 \+ /g" > __ver.bat | |
call __ver.bat | |
if "%REV%"=="" echo No revision found in %LOG% setting to beggining of repo && set REV=1 | |
del __ver.bat | |
:latest | |
svnlook history %REPO% -l 1 | head -n 3 | tail -n 1 | sed -re "s/[ \t]+//" | cut -d" " -f1 | sed -re "s/^/set \/a NEXTREV=1 \+ /g" > __ver.bat | |
call __ver.bat | |
del __ver.bat | |
if "%NEXTREV%"=="%REV%" echo Latest revision is same as repo, nothing to dump && goto exit | |
:dump | |
set DUMP=%DUMPBASE%-%REV%.dump | |
set REV=%REV%:HEAD | |
echo Dumping revision range %REV% to %DUMP% log %LOG% | |
svnadmin dump %REPO% --incremental -r %REV% >%DUMP% 2>>%LOG% | |
tail %LOG% | |
:exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment