CVS to GIT Migration: Invalid Change Text

While migrating one of our CVS repositories, I got the following error:

ERROR: The command 'cvs -Q -R -f -d :local:/cvsroot co -r1.1.2.1 -p -kb snapRETAIL_Archive/Server/Db/scripts/Programmability/Functions/FN_GetBinType.sql' failed with exit status=1
and the following output:
cvs checkout: Dropping data: pos>vec->text.nlines
cvs [checkout aborted]: invalid change text in /cvsroot/snapRETAIL_Archive/Server/Db/scripts/Programmability/Functions/FN_GetBinType.sql,v

After some detective work, I determined that the problem was an improperly formatted CVS(RCS) file with the following format:

...

1.1
log
@file FN_GetBinType.sql was initially added on branch Branch_1_1_0_4.
@
text
@@

1.1.2.1
log
@*** empty log message ***
@
text
@d1 1
a1 29
...

What is happening is the 1.1 version of the code has been created with an empty file.  Then the 1.1.2.1 version is attempting to update that revision by deleting one line of text and then adding the following 29 lines of new text.  However, since the 1.1 version didn’t actually have any lines of text this operation fails.  I’m not sure how this was caused, but I do recall similar issues when a file is added to a branch that is not on the main development line.

The simple solution in this case was changing the original text to be a single line.

text
@
@

I did try removing the deleted text, but this caused the same error.  Presumably the update expects existing text.

Leave a Reply

Your email address will not be published. Required fields are marked *