Skip to content

Instantly share code, notes, and snippets.

@dredix
Created January 20, 2012 03:44
Show Gist options
  • Save dredix/1644847 to your computer and use it in GitHub Desktop.
Save dredix/1644847 to your computer and use it in GitHub Desktop.
Copy the files added and modified since the last commit from a mercurial repository to the target directory.
REM HGCOPY: Copy the files added and modified since the last
REM commit from a mercurial repository to the target directory.
REM Syntax: hgcopy [dest_path]
@echo off
if [%1]==[] goto:Syntax
REM Only copy added and modified files.
for /F "" %%I in ('hg st -man') do call :Copyfile %%I %1\%%I
goto:eof
:Copyfile
if not exist "%~dp2" md "%~dp2"
copy /y "%1" "%2"
goto:eof
:Syntax
echo Syntax: hgcopy [dest_path]
goto:eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment