Created
October 16, 2012 05:18
-
-
Save h-mochizuki/3897339 to your computer and use it in GitHub Desktop.
(svn) Export changed files between two revisions.
This file contains hidden or 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 | |
| setlocal | |
| rem **************************************************************************** | |
| rem SVNから差分ファイルをエクスポートするバッチファイル | |
| rem 使い方: | |
| rem $ diffexport <FromRev> <ToRev> <WorkDir> <OutputDir> | |
| rem 例: | |
| rem $ diffexport 0 HEAD "c:\project" "c:\output" | |
| rem | |
| rem 必要な環境: | |
| rem - SVN を別途インストールし、実行ファイルパスを PATH に追加してください。 | |
| rem **************************************************************************** | |
| set diffexpHome=%~dp0 | |
| set diffFile=%diffexpHome%%DATE:/=%.diff | |
| set fromRev=%~1 | |
| set toRev=%~2 | |
| set workDir=%~3 | |
| set output=%~4 | |
| cd %workDir% | |
| svn diff -r %fromRev%:%toRev% --summarize > "%diffFile%" | |
| for /f "usebackq eol=# delims=" %%z in ("%diffFile%") do call :export "%%z" | |
| del "%diffFile%" | |
| goto eof | |
| rem 一行ごとにエクスポートする処理 | |
| :export | |
| set exportLine=%~1 | |
| set filePath=%exportLine:~8% | |
| rem 先にフォルダを作らないとエクスポート時にエラーが発生する | |
| mkdir "%output%\%filePath%" > nul 2>&1 | |
| rmdir /Q "%output%\%filePath%" > nul 2>&1 | |
| del "%output%\%filePath%" > nul 2>&1 | |
| svn export -r %toRev% "%workDir%\%filePath%" "%output%\%filePath%" | |
| set exportLine= | |
| set filePath= | |
| :eof | |
| endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment