简体   繁体   English

使用 cvs2git 从 CVS 迁移到 GIT 后的空关键字字段

[英]Empty keywords fields after migration from CVS to GIT using cvs2git

I am migrating many repositories from CVS to GIT.我正在将许多存储库从 CVS 迁移到 GIT。 I used cvs gitimport first, but it didn't work properly.我首先使用了 cvs gitimport,但它无法正常工作。 cvs2git works (almost) fine. cvs2git 工作(几乎)很好。 Unfortunately there is one issue that worked in cvs gitimport and does not work in cvs2git (and is important for me) After migration using cvs2git, fields containing keywords (in specific files) are empty:不幸的是,有一个问题在 cvs gitimport 中有效,但在 cvs2git 中无效(这对我很重要)使用 cvs2git 迁移后,包含关键字(在特定文件中)的字段为空:


$Header$ $头$

$Revision$ $修订$

$Author$ $作者$

$Date$ $日期$

"filename" Revision: 1.2 “文件名”修订版:1.2


I tried different configurations of: ctx.revision_collector, ctx.revision_reader,_keyword_handling but the effect is still the same.我尝试了不同的配置:ctx.revision_collector, ctx.revision_reader,_keyword_handling 但效果还是一样。

The main commands I used:我使用的主要命令:

cvs2git --blobfile=cvs2git-tmp/${module}-tmp/git-blob.dat --dumpfile=cvs2git-tmp/${module}-tmp/git-dump.dat --username=migrationuser --encoding=ascii --encoding=utf8 --encoding=cp1250 --encoding=iso8859_2 --fallback-encoding=ascii --retain-conflicting-attic-files ${module} cvs2git --blobfile=cvs2git-tmp/${module}-tmp/git-blob.dat --dumpfile=cvs2git-tmp/${module}-tmp/git-dump.dat --username=migrationuser --encoding= ascii --encoding=utf8 --encoding=cp1250 --encoding=iso8859_2 --fallback-encoding=ascii --retain-conflicting-attic-files ${module}

git --bare init "projectname" cd "projectname" cat ../../cvs2git-tmp/git-blob.dat ../../cvs2git-tmp/git-dump.dat | git --bare init "projectname" cd "projectname" cat ../../cvs2git-tmp/git-blob.dat ../../cvs2git-tmp/git-dump.dat | git fast-import git branch -D TAG.FIXUP git gc --prune=now git repack -a -d -f git fast-import git branch -D TAG.FIXUP git gc --prune=now git repack -a -d -f

Has anyone managed to solve such a problem?有没有人设法解决这样的问题? Thank you in advance for your answer预先感谢您的回答

I use the cvsconvert program from cvs-fast-export我使用cvs-fast-export 中cvsconvert程序

It mostly expands keywords as a CVS user would expect them to be expanded (I'm not sure if it handles $CVSHeader$ or a custom LocalKeyword defined in CVSROOT/config , but I'll be testing that soon).它主要扩展关键字,因为 CVS 用户希望它们被扩展(我不确定它是否处理$CVSHeader$CVSROOT/config定义的自定义LocalKeyword ,但我将很快进行测试)。

Once you've converted to Git, IFF you want to continue using per-file keyword expansion then you might consider using Git's $Format:$ feature which is enabled by setting the export-subst attribute for all files needing such expansions, and generating your releases with git-archive(1) .一旦您转换为 Git,如果您想继续使用每个文件的关键字扩展,那么您可以考虑使用 Git 的$Format:$功能,该功能通过为需要此类扩展的所有文件设置export-subst属性来启用,并生成您的使用git-archive(1) 发布 Note these are only expanded when the release is created with git archive , but generally that's when they're most useful anyway.请注意,这些仅在使用git archive创建发布时才会扩展,但通常这是它们最有用的时候。

For example I replace my old occurrences of $Id$ or $CVSHeader$ with something like the following (adapted where necessary for different comment or string constant syntax, and of course with the actual project name and file path):例如,我将旧出现的$Id$$CVSHeader$替换为如下所示的内容(在必要时针对不同的注释或字符串常量语法进行调整,当然还有实际的项目名称和文件路径):

#ident  "@(#)PROJECT:FILEPATH:$Format:%D:%ci:%cN:%h$"

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

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