加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在Windows *中如何将Mercurial资源库转换为Git?

发布时间:2020-12-13 20:50:23 所属栏目:Windows 来源:网络整理
导读:Possible Duplicate: 07000 有一个Mercurial存储库,我想转换为Git,这是我们在工作中使用的。我安装了Mercurial(Windows),而且我已经在本地克隆了Hg存储库。我坚持尝试转换它。 我发现的大多数页面都假定我使用的是Unix / Linux,而最常见的建议是hg-fast-

Possible Duplicate:
07000

有一个Mercurial存储库,我想转换为Git,这是我们在工作中使用的。我安装了Mercurial(Windows),而且我已经在本地克隆了Hg存储库。我坚持尝试转换它。

我发现的大多数页面都假定我使用的是Unix / Linux,而最常见的建议是hg-fast-export,似乎只适用于那些操作系统。我可以访问Git Bash。我已经达到这一点(线条包装更容易阅读):

$ ~/codeingit/fast-export/hg-fast-export.sh -r
        ~/codeinmercurial/projectiwanttoconvert

作为回应,我得到:

ImportError: No module named mercurial

我已经阅读了许多关于这个的网页,再次假定我使用的是Unix / Linux,而且我已经安装了Mercurial。

有没有人在Windows上成功将Hg仓库转换为Git,并可以写一个分步指南来做到这一点?

1) Install Cygwin或 Bash on Windows 10

Cygwin的

>运行setup.exe
>选择从Internet安装
>在“选择包”对话框中:

>单击树顶部的“安装”(“全部”旁边),直到显示“默认”
>展开Devel子树:安装git(从Skip更改为版本号)
>在Devel子树中:安装mercurial(从Skip更改为版本号)
>安装Python子树(从默认更改为安装)
>点击下一步

>如果提示您解决依赖关系,请单击下一步
拿一杯咖啡,看你最喜爱的电影,或者休息一下

Cygwin安装完成后,打开一个bash shell来运行以下步骤中指定的命令。 bash的快捷方式将被称为Cygwin Terminal。

Windows 10

> Install Bash on Windows 10
>喝一杯咖啡
>打开Bash并键入以下内容:

> sudo apt install git
> sudo apt install mercurial

2)安装fast-export

打开终端(bash shell)并安装快速导出:

   git clone git://repo.or.cz/fast-export.git

3)初始化新的git repo并迁移汞回购

   mkdir new_git_repo
   cd new_git_repo
   git init
   ../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo
   git checkout HEAD

潜在错误

fatal: Invalid raw date "<devnull@localhost> xxx -xxxx" in ident:  <><devnull@localhost> xxx -xxxx

尝试添加“authors.txt”文件,如here所述,其中包含:

<>=devnull <devnull@localhost>

命令行现在显示:

../fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo -A ../fast-export/authors

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读