简体   繁体   English

如何验证使用cvs2git的CVS到Git的转换?

[英]How to verify a CVS to Git conversion that used cvs2git?

I am in the process of migrating CVS repositories into Git using cvs2git (part of cvs2svn). 我正在使用cvs2gitcvs2svn的一部分)将CVS存储库迁移到Git中。 When I run the tool, it appears to work perfectly and I end up with a working git repository. 当我运行该工具时,它似乎运行良好,最终得到了一个有效的git存储库。 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. 至少,我需要确认最新的git commit中的文件内容与最新的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. 我大约有30个可转换的存储库,因此,我希望能使用某种自动化的方法。

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. 到目前为止,我想出的唯一一件事就是对目录进行校验和,以验证文件是否相同,但是每个文件夹中都有一个.cvs目录,因此我认为这不起作用。

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. 至少,我需要确认最新的git commit中的文件内容与最新的CVS commit中的文件内容相同。

You can use find to list all the files and exclude .git and .cvs . 您可以使用find列出所有文件,并排除.git.cvs Pipe the result to something like sha1sum to get checksums for all the files. 将结果通过管道传输到sha1sum之类的文件,以获取所有文件的校验和。 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. 鉴于Git和CVS的模型截然不同,我不知道这会有多大用处。

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 somefilecvs log somefile (自从我使用CVS以来已经很久了,我什至不记得那是不是一个有效的命令)。 git log takes many formatting options, you might even be able to get it to spit out in the same format as CVS. git log具有许多格式选项,您甚至可以使其以与CVS相同的格式吐出。

As for tags, you can check git tag -l against the expected list of tags. 至于标签,您可以对照预期的标签列表检查git tag -l You can then check each tag out in turn and compare their contents with the find/diff commands as above. 然后,您可以依次签出每个标签,并将它们的内容与上述find / diff命令进行比较。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM