How to verify a CVS to Git conversion that used cvs2git?

290 Views Asked by At

I am in the process of migrating CVS repositories into Git using cvs2git (part of cvs2svn). When I run the tool, it appears to work perfectly and I end up with a working git repository. However, I need a way of verifying that the conversion occurred successfully.

At the very minimum I need to confirm that the contents of the files in the latest git commit are identical to the contents of the files of the latest CVS commit. I'd also like to verify, if possible, that the commit authors match, that the timestamps of the commits are correct, that tags are preserved (I know that the tag/branch model doesn't match exactly, but at least the tag names are preserved as branch names), and any other data that would be important to verify. I have about 30 repositories to convert, so I would appreciate any method that is automated somewhat.

The only thing I've come up with so far is to do a checksum of the directories just to verify that the files are the same, but there is a .cvs directory in every folder so I don't think that would work.

1

There are 1 best solutions below

2
On

At the very minimum I need to confirm that the contents of the files in the latest git commit are identical to the contents of the files of the latest CVS commit.

You can use find to list all the files and exclude .git and .cvs. Pipe the result to something like sha1sum to get checksums for all the files. Capture the result.

$ find cvs_checkout -name .cvs -prune -o -type f -print0 | xargs -0 sha1sum > cvs.sum

$ find git_checkout -name .git -prune -o -type f -print0 | xargs -0 sha1sum > git.sum

Then diff the two checksum files. There should be no differences.

$ diff cvs.sum git.sum

I'd also like to verify, if possible, that the commit authors match, that the timestamps of the commits are correct, that tags are preserved...

Given how radically different Git's and CVS's models are, I don't know how useful this would be.

But if you really want to, I suppose you'd write something for each file that compared git log somefile with cvs log somefile (it's been so long since I've used CVS I don't even remember if that's a valid command). git log takes many formatting options, you might even be able to get it to spit out in the same format as CVS.

As for tags, you can check git tag -l against the expected list of tags. You can then check each tag out in turn and compare their contents with the find/diff commands as above.

Good luck!