git - 如何在 *Windows* 中将 Mercurial 存储库转换为 Git...?

标签 git mercurial

<分区>

Possible Duplicate:
Converting a Mercurial (hg) repository to Git on Windows (7)

有一个 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。

有没有人成功地将 Hg 存储库转换为 Windows 上的 Git,并且可以编写分步指南来完成此操作?

最佳答案

1) Install CygwinBash on Windows 10

Cygwin

  • 运行 setup.exe
  • 选择从 Internet 安装
  • 选择包对话框中:
    • 单击树顶部(所有 旁边)的安装,直到它显示默认
    • 展开 Devel 子树:安装 git(从 Skip 更改为版本号)
    • Devel 子树中:安装 mercurial(从 Skip 更改为版本号)
    • 安装 Python 子树(从默认更改为安装)
    • 点击下一步
  • 如果提示解决依赖关系,点击下一步
  • 喝杯咖啡,看你最喜欢的电影,或者小睡一会儿

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

Windows 10

2) 安装fast-export

打开终端(bash shell)并安装fast-export:

   https://github.com/frej/fast-export.git

3) Initialize new git repo and migrate mercurial 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


Potential Error

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

按照 here 的描述尝试添加“authors.txt”文件,包含:

<>=devnull <devnull@localhost>

命令行现在显示为:

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

关于git - 如何在 *Windows* 中将 Mercurial 存储库转换为 Git...?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11320587/

相关文章:

Git Tower 无法重新应用存储 : Conflicts in index

Git功能分支审查: Rewrite or add commit?

url - 为什么Mercurial的ssh ://URL use two slashes before the path?

mercurial - 您如何列出 mercurial 存储库中已更改的所有文件,仅限于草稿变更集?

version-control - Mercurial:更改一些尚未推送的提交的用户名?

git - 在 Git 中找出您从中克隆的原始存储库的名称

git - 在 git 中 checkout 时的状态 D

windows - Tortoise git 失败,没有可用的支持的身份验证方法(服务器发送 : publickey)

python - Cygwin和Windows路径冲突;同时使用 Windows 和 cygwin Python

mercurial - Mercurial 浅克隆扩展的状态如何?