Search code examples
version-controldiffcvschangelog

How to get the cvs change list for a new file


As part of my work I've been asked to log the cvs commands for creating the changelists for files I've updated as follows:

cvs diff -r 1.172 -r 1.173 ./somefile.php

But if the file is newly created for that job, no previous version number exists so I can't compare it to anything. Ideally I'd like to compare it with an empty file so it shows all lines were added. Can this be done?


Solution

  • Initially the best way I found to do this was to use:

    cvs annotate -r1.1 ./somefile.php
    

    Assuming the 1.1 is the version number of the new file. It isn't a perfect solution as it displays the added lines in a different format to the diff.

    Update

    However a better solution, which now seems obvious, has just occurred to me. When creating a new file, first check it in to CVS blank, then check it in again with the code, so I can do something like...

    cvs diff -r1.1 -r1.2 ./somefile.php