我使用的是 cvs2git 版本 2.5.0。 我有一个旧的 CVS 存储库,我正在尝试将其转换为 git 存储库。 我运行了 cvs2git 命令如下
cvs2git --blobfile=git-stage/git-blob.dat --dumpfile=git-stage/git-dump.dat --keep-cvsignore --retain-conflicting-attic-files --encoding=ascii --encoding=utf8 --encoding=utf16 --fallback-encoding=utf8 cvsroot
这次运行给了我一堆错误,如下
enter code here
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename1,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename1,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename1,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename1,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename2,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename3,v': 1.1.1.1 1.1.1
ERROR: Multiple definitions of the symbol 'MYSYM' in 'cvsroot/path/filename4,v': 1.1.1.1 1.1.1
我检查了引发此错误的文件,这就是我在文件开头看到的内容
head 1.1;
branch 1.1.1;
access ;
symbols MYSYM:1.1.1.1 MYSYM:1.1.1;
locks ; strict;
comment @# @; ...
我考虑的一个选择是使用 cvs2git 的 --exclude 选项,但我不想忽略这些文件;他们太多了——数百个…… 我正在考虑采用的另一种可能的解决方法是通过编写爬虫和 sed 脚本来删除额外的定义 然而我的问题是
感谢您的帮助
让我澄清一下 - 这并不完全是我正在寻找的答案。这只是一个解决方法,可以让我继续进行转换
我在这里发帖,这样它就可以解除像我一样被屏蔽的人的屏蔽。
我仍在寻找一个优雅的答案 - 所以这个“答案”不被接受
对于我的解决方法,我编写了一个脚本,循环遍历数千个 cvs 文件 'cvsroot/path/filenamex,v' 并使用 sed 删除重复的定义
for fname in \
cvsroot/path1/path2/file1,v \
# thousands of files \
do
echo "processing $fname"
sed -i "s/mysim:1.1.1.1//g" $fname
sed -i "s/MYSIM:1.1.1.1//g" $fname
done
因此我从 CVS 文件中删除了两个定义之一,此后 cvs2git 可以继续并完成工作