问题标签 [hg-git]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
407 浏览

git - 使用 mercurial 和 hg-git 作为 github 客户端

我是一个满意的 mercurial 用户,我想用它来处理 github 上的一些 repos。我已经安装hg-git(仍然有连接问题,但这不是问题)并查看了关于 SO 的文档和各种问题,但我仍然不确定它提供的解决方案有多完整。

  1. git / github 是否有一些重要的功能hg+hg-git支持不可用、有限或容易出现问题?我使用分支和合并、标签,偶尔还使用 mercurial 的commit --amend命令。我真的不需要书签、subrepos、自定义钩子或 mercurial 补丁队列。

  2. 由于 和 的不同分支模型,是否存在问题或git限制hg?(这个有六年历史的问题表明,这在当时并不是一种无缝的体验。)

  3. hg-git网站上,我读到“理论上,变更集 ID 不应该改变 [在 hg -> git -> hg 转换中],尽管这可能不适用于复杂的历史。” 我应该对此有多担心?如果我只是在github一个hg仓库之间同步(两个方向)会发生这种情况吗?

我正在研究两个用例:

A)hg用作大型项目的 github 客户端,有很多分支,通常由 git 用户(master分支等)开发

B)github用于托管我使用 mercurial 开发的自己的(较小的)项目。

我不期望 100% 完全更换。我拥有并使用git,我只是更喜欢hg每天使用。我的大部分工作都是在 OS X 上完成的,如果这很重要的话。

0 投票
1 回答
440 浏览

git - pulling git repo with mercurial fails with error "path contains illegal component .hg/00changelog.i"

I have a project versioned with git and our client wants to access it with Mercurial, so our idea was to convert the project using the plugin “hg-git”.

The error is thrown when cloning the "converted" repository with a hg command following these steps:

  • create a git repository on Bitbucket
  • clone locally using git commands, added an android project, commit, pushed. Works fine.
  • Run hg-git "convert" command on the local folder.
  • I add, commit, push to Bitbucket.

The project structure was automatically changed by the plugin and a new folder containing the .hg files was generated inside the my folder and looks like that:

When I try to import using Mercurial commands the "converted" git project from Bitbucket it is aborted:

To try to solve the "nest" problem I read on some SO post that the .hg folder has to be on the same level as the .git folder. The structure changed to:

I commit the changes, push to Git repo, then tried again to hg pull:

I have been looking for almost 2 days to solve this second error, reinstalled from brew everything, it failed, then macport again, checked python and mercurial, tried to create a new bitbucket repo and start from scratch, looked on GG and SO other related posts, modified the .hgrc file, I still get the error.

I tried another option: "Mirror git and mercurial repos the lazy way" by Greg Malcolm (same local project mirrors/sync both a git repository on one side and a mercurial on the other).

That was the only one working solution during my test. But that is not exactly what I wanted to do as you have 2 different repo to sync and I would like to have only one with the .git and .hg in it.

I hope someone can help me either to solve the error message for the solution using a single Git repo accepting both .git push and hg pull and or tell me if the "mirroring" of 2 different repo (one git, one hg) is the only working option.

Thx!

Config / installation: Mac Os Sierra Installed the rest as said in this SO answer - macports - python 2.7 - Mercurial - hggit

Content of .hgrc file :

0 投票
0 回答
117 浏览

git - GitHub 不会接受这个旧的提交。我如何解决它?

我正在将 Mercurial 存储库转换为 Git,以托管在 GitHub 上。与 hggit 的转换看起来很顺利,但是尝试推送到 GitHub 失败了:

显然,导致错误的原因是在 Mercurial 中使用一个空的命名分支(分支名称是一个空字符串)完成了一个特定的签入。

那么解决这个问题的最佳方法是什么?我设想必须从存储库中删除有问题的提交,然后以某种方式重新应用 1000 个左右的成功提交。

提交图

我想这可以在 Mercurial og Git 中完成,我欢迎任何一个关于如何去除有问题的提交的建议。

0 投票
1 回答
1411 浏览

version-control - 一种方法 hg 到 git sync

我有一个 mercurial 存储库,其中包含一个我正在尝试逐步拆分的整体项目。在执行这些操作时,我想我会将新的子项目转换为 git,从而实现单向同步。

关于我在做什么的更多细节:

  • hg 存储库和新的 git 存储库位于私有 bitbucket 云帐户中。
  • 我想在进行拆分时保留提交历史记录
  • 我们所有的开发都是基于 Windows 的(尽管我愿意使用基于 unix 的系统进行迁移)
  • 最初的 repo 已有 7 年历史,它有各种各样的标签、封闭的分支、一些带有不受支持的 git 字符的分支。但更重要的是,如果我只能迁移默认/主服务器,我会很高兴(如果它可以帮助我完成工作并且不意味着丢失历史记录)
  • 随着我们逐渐转换 repo 中的一些项目(假设我有 30 个项目并且我想逐步移动它们),我需要做一种从 hg 同步到 git 的方式。我不害怕合并,我很高兴将我的新 repo 工作保留在 master 之外,然后随着 hg 的变化而变基。
  • 我知道我们的 mercurial repo 配置不正确(我看到了多个头等),但是当我深入研究 mercurial 主干时,我已经超出了我的舒适区。

到目前为止,我尝试了几种工具,例如快速导出、mercurial hg hggit 插件。但是,我正在努力寻找好的分步工具。(以及此线程Convert Mercurial project to Git中的几乎所有方法)

fast-export 是给我带来最佳结果的工具,我能够一次性迁移项目,但是当我尝试重新同步时,我开始遇到错误,例如外部修改了分支和多个头。

现在我更详细地解释了我的问题,我可以提出这个问题。

什么是最好的方法和工具让我能够做一个单一的方式 hg 到 git 迁移?

另外,如何确保我的 mercurial 存储库已正确配置,以避免在迁移到 git 时出现任何潜在问题?

0 投票
1 回答
957 浏览

python - Hg Git Pull 导致打开文件过多错误

我有一个跟踪 git 存储库的 Mercurial 存储库。它在 Windows 10 上运行良好。现在我将它作为目录移动到 Mac,然后运行hg reset -Ca只是为了清理它。现在我试图运行hg pull它会导致这样的错误:

我查了一下,看起来我有最新版本的hg-gitdulwich

Mercurial 也是最新的

我检查了 Windows 上的 Mercurial 版本,4.4.2如果这很重要。我想知道是否有人遇到过这样的问题,并且可能有解决方法或修复方法。

0 投票
1 回答
345 浏览

easy-install - 如何在 Debian Stretch 上安装 hg-git 插件?

Debian Jessie 和 sid 都有一个mercurial-git包含该hg-git插件的软件包。然而,这个包被(自动)从 Debian Stretch 中移除到一个发布关键的 bug中。

但是 - 我需要安装并运行它。当然这应该是可能的,对吧?

好吧,我按照插件页面上的安装说明进行操作:

  • 我跑了apt-get install python-setuptools python-setuptools-git python4-setuptools python3-setuptools-git
  • 我跑了easy_install hg-git,它似乎工作

但是,当我运行各种 mercurial 操作时,我得到的第一行是错误消息:

(不管我是否在做任何与 git 相关的事情。)

我的问题:

  1. 为什么会这样?
  2. 在 hggit 工作时,我需要做什么才能使错误消息消失?

现在,

如何正确安装 dulwich 以使 hg-git 在 Windows 上运行?

0 投票
1 回答
1575 浏览

git - 如何在不丢失分支的情况下将 mercurial 存储库转换为 git 存储库?

我想将 mercurial repo 转换为 git repo。实际上我做到了,但我没有看到树枝。转换 repo 后,我只能看到一个分支(作为主分支),我看不到任何其他分支,但我可以看到历史记录(所有更改)是正确的。单击任何提交时,我可以看到如下信息:

但我在左侧看不到 sevgi-2.0.0 分支(我正在使用 sourcetree)。

我的步骤:

mercurial.ini 文件:

hg bookmark -r 2.0.0 master(也像这样尝试过:)hg bookmark -r default master然后我从 cmd 工作了这一行

在完成这一行之后,我的输出如下:

然后我在这条线上工作git config --bool core.bare false。毕竟我确实在 .git 下打开了分支文件夹,而这个旧文件夹是空的。我想在我的仓库中看到分支。

参考:https ://helgeklein.com/blog/2015/06/converting-mercurial-repositories-to-git-on-windows/

我也尝试了快速导出,但没有奏效。

0 投票
1 回答
297 浏览

git - 将 hg 转换为 git,但使用 git repo (SourceTree) 会出错?

我已经通过使用将 mercurial 存储库转换为 git 存储库hg-git(例如:如何将 mercurial 存储库转换为 git 存储库而不丢失分支?)。

现在我有 .git 和 .hg 文件夹,但我不需要 .hg 文件夹。但是如果我删除这个文件夹,我就不能用 SourceTree 打开我的项目文件夹

.hg文件夹有bookmark, git-mapfile, hgrc,branch等文件和store文件夹。我想我不需要这些文件。我应该怎么办 ?

0 投票
2 回答
149 浏览

ubuntu - 如何从 Ubuntu 18.04.2 中完全删除 hg-git

使用 mbed-cli 更新 Mbed 存储库时,出现以下错误:

我不想使用 hg-git 并试图完全删除它。Mbed-cli 使用 Python,所以我尝试了各种 Python 工具来删除 hg-git,但仍然出现错误。我什至不确定这实际上是 mbed-cli 的错误,因为它出现在我知道是 mbed 的一部分之后(即,以“[mbed]”开头的行)。我还尝试在文件中找到错误的来源(使用 'grep -rnw . -e "hg-git"'),但作为 Ubuntu 上的一个新手,我无法做到这一点。

关于错误消息的来源和/或我如何摆脱它并完全删除 hg-git 的任何想法?

0 投票
1 回答
415 浏览

git - Mercurial -> 保留提交哈希的 Git 迁移

是否有任何现有工具能够将 mercurial 存储库导出到 git 存储库,同时保留提交哈希?

我知道 hg-git 或 fast-export.git,但是它们会使用新的哈希创建新的提交(并且似乎没有任何选项可以配置它)。我们在 Bitbucket 上托管了数百个 mercurial 存储库,其中包含大量挂钩、下载链接等,具体取决于精确的哈希值。能够保留哈希值将为我们节省大量更新所有外部资源所需的工作量。