迁移简介
应用工具:cvs2git
工作原理:文件系统的copy, from cvs repository to export temp file, then import to Git repository.
使用条件: Git version 1.5.4.4 or later (我们的目标 git 库版本:
git --version
git version 1.9.0
git --version
git version 1.9.0
cvs2git工具安装
迁移过程
具体的迁移过程:
以下为迁移wxxr-core-framework
1. 在123.1上用cvs2git把cvs仓库,导出成git的备份文件(blob file and dump file)
- cvs2git --blobfile=/tmp/cvs2git/output/git-blob-cfw.dat --dumpfile=/tmp/cvs2git/output/git-dump-cfw.dat --username=zhangjunqing --fallback-encoding=GBK /app/cvsroot/wxxr-projects/wxxr-core-framework
- 创建本地git仓库
- git init --bare wxxr-core-framework.git
- 下载导出的git的备份文件到本地临时目录 **
- cd /Users/zhangjq/temp/cvs2git
- scp -r djboss@192.168.123.1:/tmp/cvs2git/output/git-* .
- 用git的fast-import命令把从cvs导出的git备份文件导入刚创建的git仓库** cd /Users/zhangjq/git/wxxr-core-framework/wxxr-core-framework.git** cat /Users/zhangjq/temp/cvs2git/git-blob-cfw.dat /Users/zhangjq/temp/cvs2git/git-dump-cfw.dat | git fast-import
- 在Stash 上创建远程仓库** 创建了framework-core 仓库集,并在此仓库集下创建了wxxr-core-framework, wxxr-core-web 等远程仓库**http://developer.corp.wxxr.com.cn/git/projects/FRMCORE/repos/wxxr-core-framework/browse
- 在本地执行** git branch -D TAG.FIXUP (执行git branch -a 没有找到这个分支,为什么删除?error: branch 'TAG.FIXUP' not found. )
-
- git push --all origin (将本地的所有分支都推送到远程主机)
- git push -
tags origin (最后,git push不会推送标签(tag),除非使用-tags选项。)
- 至此,完成了wxxr-core-framework的迁移。下一步执行比较验证。
Git 时不时地将这些对象打包至一个叫 packfile 的二进制文件以节省空间并提高效率。当仓库中有太多的松散对象,或是手工调用git gc 命令,或推送至远程服务器时,Git 都会这样做。
附:迁移脚本
迁移验证
用本地cvs代码库代码与git下载的库代码比较,有$Revision$ 的少版本信息外,其它一切正常。
迁移报告
wxxr-core-framework
fast-import wxxr-core-framework source code:
:)
@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:helpmojo (generate-help-mojo) on project wxxr-build-maven-plugin: Execution generate-help-mojo of goal org.apache.maven.plugins:maven-plugin-plugin:3.2:helpmojo failed: 48188 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:helpmojo (generate-help-mojo) on project wxxr-build-maven-plugin: Execution generate-help-mojo of goal org.apache.maven.plugins:maven-plugin-plugin:3.2:helpmojo failed: 48188
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution generate-help-mojo of goal org.apache.maven.plugins:maven-plugin-plugin:3.2:helpmojo failed: 48188
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:144)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 48188
at org.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.apache.maven.tools.plugin.annotations.scanner.DefaultMojoAnnotationsScanner.scanFile(DefaultMojoAnnotationsScanner.java:139)
at org.apache.maven.tools.plugin.annotations.scanner.DefaultMojoAnnotationsScanner.scan(DefaultMojoAnnotationsScanner.java:85)
at org.apache.maven.tools.plugin.annotations.JavaAnnotationsMojoDescriptorExtractor.scanAnnotations(JavaAnnotationsMojoDescriptorExtractor.java:125)
at org.apache.maven.tools.plugin.annotations.JavaAnnotationsMojoDescriptorExtractor.execute(JavaAnnotationsMojoDescriptorExtractor.java:104)
at org.apache.maven.tools.plugin.scanner.DefaultMojoScanner.populatePluginDescriptor(DefaultMojoScanner.java:108)
at org.apache.maven.plugin.plugin.AbstractGeneratorMojo.execute(AbstractGeneratorMojo.java:233)
at org.apache.maven.plugin.plugin.HelpGeneratorMojo.execute(HelpGeneratorMojo.java:88)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
... 20 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
临时解决办法:将commons-jelly 版本由1.0改为1.0-RC1
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly</artifactId>
<version>1.0-RC1</version>
</dependency>