andyj2ee

java tec sky

统计

留言簿(4)

activemq

aop

design pattern

other blog

spring

workflow

多线程

软件架构师

阅读排行榜

评论排行榜

2015年1月13日 #

系统cvs to Git 迁移

迁移简介

应用工具: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 gc --prune=now
    • 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

cvs2svn Statistics:
------------------
Total CVS Files:              3000
Total CVS Revisions:          9439
Total CVS Branches:          33449
Total CVS Tags:            3278944
Total Unique Tags:            2446
Total Unique Branches:          24
CVS Repos Size in KB:       159751
Total SVN Commits:            5260
First Revision Date:    Wed May 31 15:56:03 2006
Last Revision Date:     Sun Jan  4 17:22:23 2015
------------------
Timings (seconds):
------------------
1065   pass1    CollectRevsPass
0   pass2    CleanMetadataPass
0   pass3    CollateSymbolsPass
648   pass4    FilterSymbolsPass
1   pass5    SortRevisionsPass
37   pass6    SortSymbolsPass
436   pass7    InitializeChangesetsPass
82   pass8    BreakRevisionChangesetCyclesPass
82   pass9    RevisionTopologicalSortPass
296   pass10   BreakSymbolChangesetCyclesPass
406   pass11   BreakAllChangesetCyclesPass
413   pass12   TopologicalSortPass
319   pass13   CreateRevsPass
159   pass14   SortSymbolOpeningsClosingsPass
15   pass15   IndexSymbolsPass
432   pass16   OutputPass
4391   total

fast-import wxxr-core-framework source code:

git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:      45000
Total objects:        41365 (      2260 duplicates                  )
blobs  :         7817 (       709 duplicates       6887 deltas of       7248 attempts)
trees  :        30677 (      1551 duplicates      12608 deltas of      29589 attempts)
commits:         2871 (         0 duplicates          0 deltas of          0 attempts)
tags   :            0 (         0 duplicates          0 deltas of          0 attempts)
Total branches:        2472 (        24 loads     )
marks:     1073741824 (     11397 unique    )
atoms:           2772
Memory total:          4532 KiB
pools:          2423 KiB
objects:          2109 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit      = 8589934592
pack_report: pack_used_ctr            =      23737
pack_report: pack_mmap_calls          =        824
pack_report: pack_open_windows        =          1 /          1
pack_report: pack_mapped              =    7439224 /    7439224
---------------------------------------------------------------------

:)

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);

posted @ 2015-01-13 18:53 java光环 阅读(724) | 评论 (0)编辑 收藏