gitmigrationcvscvs2git

Empty keywords fields after migration from CVS to GIT using cvs2git


I am migrating many repositories from CVS to GIT. I used cvs gitimport first, but it didn't work properly. cvs2git works (almost) fine. 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:


$Header$

$Revision$

$Author$

$Date$

"filename" Revision: 1.2


I tried different configurations of: ctx.revision_collector, ctx.revision_reader,_keyword_handling but the effect is still the same.

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}

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

Has anyone managed to solve such a problem? Thank you in advance for your answer


Solution

  • I use the cvsconvert program from my fork of cvs-fast-export (The original version now mistakenly blindly uses -kb to check out revisions, but that's entirely unlike what CVS normally does!)

    My version currently does not pass any -k option, so mostly expands keywords as a CVS user would expect them to be expanded.

    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). Note these are only expanded when the release is created with git archive, but generally that's when they're most useful anyway.

    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):

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