0

How can I export from CVS only the files that have been changed (committed) in a certain time period? I would like to do this so I can send a 'patch' of only the files that have changed (retaining directory structure) to a client, rather than the whole codebase.

I've discovered this answer (http://stackoverflow.com/a/2343054/421243) which gives me a list, but is there a way to export so that I can script it in a batch file?

David Cook
  • 483
  • 7
  • 25
  • Wouldn't an actual patch be sufficient? ie. `cvs rdiff -D date1 -D date2` – Burhan Ali Aug 09 '12 at 21:57
  • It probably would be sufficient, but it seems easier and less error-prone to give the client an archive to unzip over the codebase rather than apply a patch file. – David Cook Aug 10 '12 at 04:10

1 Answers1

0

Well, I couldn't let this one lie so here's a Windows batch file solution. Basically:

  • Get list of files that have changed using cvs diff
  • For each listed file, export from cvs (-N to keep directory structure)

Code:

REM Exports only files changed between %DATEFROM% and %DATETO%
REM See CVS -D switch for details on date/time input: http://docs.freebsd.org/info/cvs/cvs.info.Common_options.html

cvs -Q -d %CVSROOT% diff -N -c -D %DATEFROM% -D %DATETO% | grep "Index:" > diff.tmp

echo Extracting changed source files from CVS
for /f "tokens=2*" %%f in (diff.tmp) do (
    echo %MODULE%/%%f
    cvs -Q -d %CVSROOT% export -r HEAD -d %TARGETDIR% -N %MODULE%/%%f  > NUL 2> NUL
)
del diff.tmp
David Cook
  • 483
  • 7
  • 25
  • If you flattened out the file list you could do it with one call to cvs rather than multiple calls in a loop. On Linux I would use `xargs`. Not sure what the equivalent on Windows would be. – Burhan Ali Aug 10 '12 at 07:17