通过 fast-export 转换 Mercurial(Hg) 版本库 为 Git 版本库

Mercurial(Hg)   to  Git

fast-export 下载地址:http://repo.or.cz/w/fast-export.git

贴一下我的转换过程:

整个过程的目录结构:

Documents
├─ mzgblog-hg
└─ fast-export
└─ mzgblog-git

其中文件夹 mzgblog-hg 是要转换的 hg 版本库,mzgblog-git 是转换后的 git 版本库

具体转换过程及命令如下:

ubuntu@ubuntu-desktop:~/Documents$ mkdir mzgblog-git
ubuntu@ubuntu-desktop:~/Documents$ cd mzgblog-git
ubuntu@ubuntu-desktop:~/Documents/mzgblog-git$ git init
Initialized empty Git repository in /home/ubuntu/Documents/mzgblog-git/.git/
ubuntu@ubuntu-desktop:~/Documents/fast-export/mzgblog-git$ sh ../hg-fast-export.sh -r ../../mzgblog-hg
master: Exporting full revision 1/24 with 421/0/0 added/changed/removed files
master: Exporting simple delta revision 2/24 with 3/16/0 added/changed/removed files
master: Exporting simple delta revision 3/24 with 0/5/0 added/changed/removed files
master: Exporting simple delta revision 4/24 with 0/1/0 added/changed/removed files
master: Exporting simple delta revision 5/24 with 6/7/0 added/changed/removed files
master: Exporting simple delta revision 6/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 7/24 with 1/5/0 added/changed/removed files
master: Exporting simple delta revision 8/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 9/24 with 2/0/0 added/changed/removed files
master: Exporting simple delta revision 10/24 with 3/5/0 added/changed/removed files
master: Exporting simple delta revision 11/24 with 0/3/0 added/changed/removed files
master: Exporting simple delta revision 12/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 13/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 14/24 with 0/20/0 added/changed/removed files
master: Exporting simple delta revision 15/24 with 0/1/0 added/changed/removed files
master: Exporting simple delta revision 16/24 with 18/3/19 added/changed/removed files
master: Exporting simple delta revision 17/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 18/24 with 2/7/0 added/changed/removed files
master: Exporting simple delta revision 19/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 20/24 with 4/14/4 added/changed/removed files
master: Exporting simple delta revision 21/24 with 0/3/0 added/changed/removed files
master: Exporting simple delta revision 22/24 with 2/9/0 added/changed/removed files
master: Exporting simple delta revision 23/24 with 2/2/126 added/changed/removed files
master: Exporting simple delta revision 24/24 with 0/8/0 added/changed/removed files
Issued 24 commands
git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects: 5000
Total objects: 749 ( 66 duplicates )
blobs : 528 ( 63 duplicates 211 deltas)
trees : 197 ( 3 duplicates 124 deltas)
commits: 24 ( 0 duplicates 0 deltas)
tags : 0 ( 0 duplicates 0 deltas)
Total branches: 1 ( 1 loads )
marks: 1024 ( 24 unique )
atoms: 331
Memory total: 2294 KiB
pools: 2098 KiB
objects: 195 KiB
---------------------------------------------------------------------
pack_report: getpagesize() = 4096
pack_report: core.packedGitWindowSize = 33554432
pack_report: core.packedGitLimit = 268435456
pack_report: pack_used_ctr = 495
pack_report: pack_mmap_calls = 77
pack_report: pack_open_windows = 1 / 1
pack_report: pack_mapped = 2379560 / 2379560
---------------------------------------------------------------------

 

版本库转换完成!

通过 fast-export 转换 Mercurial(Hg) 版本库 为 Git 版本库

Mercurial(Hg)   to  Git

fast-export 下载地址:http://repo.or.cz/w/fast-export.git

贴一下我的转换过程:

整个过程的目录结构:

Documents
├─ mzgblog-hg
└─ fast-export
└─ mzgblog-git

其中文件夹 mzgblog-hg 是要转换的 hg 版本库,mzgblog-git 是转换后的 git 版本库

具体转换过程及命令如下:

ubuntu@ubuntu-desktop:~/Documents$ mkdir mzgblog-git
ubuntu@ubuntu-desktop:~/Documents$ cd mzgblog-git
ubuntu@ubuntu-desktop:~/Documents/mzgblog-git$ git init
Initialized empty Git repository in /home/ubuntu/Documents/mzgblog-git/.git/
ubuntu@ubuntu-desktop:~/Documents/fast-export/mzgblog-git$ sh ../hg-fast-export.sh -r ../../mzgblog-hg
master: Exporting full revision 1/24 with 421/0/0 added/changed/removed files
master: Exporting simple delta revision 2/24 with 3/16/0 added/changed/removed files
master: Exporting simple delta revision 3/24 with 0/5/0 added/changed/removed files
master: Exporting simple delta revision 4/24 with 0/1/0 added/changed/removed files
master: Exporting simple delta revision 5/24 with 6/7/0 added/changed/removed files
master: Exporting simple delta revision 6/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 7/24 with 1/5/0 added/changed/removed files
master: Exporting simple delta revision 8/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 9/24 with 2/0/0 added/changed/removed files
master: Exporting simple delta revision 10/24 with 3/5/0 added/changed/removed files
master: Exporting simple delta revision 11/24 with 0/3/0 added/changed/removed files
master: Exporting simple delta revision 12/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 13/24 with 0/4/0 added/changed/removed files
master: Exporting simple delta revision 14/24 with 0/20/0 added/changed/removed files
master: Exporting simple delta revision 15/24 with 0/1/0 added/changed/removed files
master: Exporting simple delta revision 16/24 with 18/3/19 added/changed/removed files
master: Exporting simple delta revision 17/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 18/24 with 2/7/0 added/changed/removed files
master: Exporting simple delta revision 19/24 with 0/2/0 added/changed/removed files
master: Exporting simple delta revision 20/24 with 4/14/4 added/changed/removed files
master: Exporting simple delta revision 21/24 with 0/3/0 added/changed/removed files
master: Exporting simple delta revision 22/24 with 2/9/0 added/changed/removed files
master: Exporting simple delta revision 23/24 with 2/2/126 added/changed/removed files
master: Exporting simple delta revision 24/24 with 0/8/0 added/changed/removed files
Issued 24 commands
git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects: 5000
Total objects: 749 ( 66 duplicates )
blobs : 528 ( 63 duplicates 211 deltas)
trees : 197 ( 3 duplicates 124 deltas)
commits: 24 ( 0 duplicates 0 deltas)
tags : 0 ( 0 duplicates 0 deltas)
Total branches: 1 ( 1 loads )
marks: 1024 ( 24 unique )
atoms: 331
Memory total: 2294 KiB
pools: 2098 KiB
objects: 195 KiB
---------------------------------------------------------------------
pack_report: getpagesize() = 4096
pack_report: core.packedGitWindowSize = 33554432
pack_report: core.packedGitLimit = 268435456
pack_report: pack_used_ctr = 495
pack_report: pack_mmap_calls = 77
pack_report: pack_open_windows = 1 / 1
pack_report: pack_mapped = 2379560 / 2379560
---------------------------------------------------------------------

 

版本库转换完成!