将 Mercurial 捆绑文件应用于不同的变更集

发布于 2024-12-06 16:04:21 字数 823 浏览 3 评论 0原文

TLDR:我有一个包含父级 X 的 HG 捆绑包,但我的存储库中不存在修订版 X。但是,我确定修订版 Y 的文件与修订版 X 相同。如何应用该捆绑包?

背景:

我使用 hgsubversion 与 SVN 存储库交互。

有一些我不想做出的改变。 hgsubversion 不支持部分推送。

我曾经通过手动创建临时导出/补丁文件或手动恢复 .orig 文件(hg revert 的结果)来解决此问题。

在这种情况下,我提交了我不想推送的更改,然后使用 hg strip,然后推送,然后尝试使用 hg unbundle .hg/strip-backup/file

问题hgsubversion 在提交后将原始变更集替换为从 SVN 导入的新变更集。结果:变更集 ID 发生变化。这是一个问题,因为现在 hg unbundle 不再起作用,因为它依赖于那里的父变更集(但它已被剥离)。

具有讽刺意味的是,hgsubversion本身使用strip,因此有一个备份文件,我可以用它来剥离新版本,添加剥离的旧版本,然后应用带有我的修订版本的捆绑包,导出补丁,删除两者,然后恢复 SVN 修订版。但这听起来……极其痛苦和愚蠢。难道我就没有什么更好的办法了吗?

hg移植似乎也不喜欢在回购中没有父项的捆绑包)

TLDR: I have an HG bundle with parent X, but revision X does not exist in my repo. However, I am sure that the files of revision Y are identical to revision X. How do I apply the bundle?

Background:

I use hgsubversion to interact with an SVN repo.

There were some changes I did not want to commit. hgsubversion does not support partial pushes.

I used to workaround by manually creating temporary exports/patch files, or manually restoring .orig files (result of hg revert).

In this case I committed the changes I did not want to push, then used hg strip, then pushed, then tried to use hg unbundle .hg/strip-backup/file.

Problem: hgsubversion replaces the original changeset with a new one it imports from SVN after it's committed it. Result: the changeset ID changes. This is a problem because now hg unbundle no longer works, as it relies on the parent changeset being there (but it's been stripped).

Ironically, hgsubversion itself uses strip and thus has a backup file I can use to strip the new rev, add the stripped old revision, then apply the bundle with my revisions, export the patch, strip both, and restore the SVN revision. But this sounds... extremely painful and stupid. Is there nothing better I can do?

(hg transplant doesn't seem to like the bundle without having the parent in the repo, either)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千と千尋 2024-12-13 16:04:22

如果没有捆绑包的精确父变更集,实际上不可能使用捆绑包。捆绑包由紧凑的二进制增量组成,只能应用于精确的二进制源。没有可用的“上下文”可以让 Mercurial 猜测如何像补丁一样将它们应用到其他修订版。在 Mercurial 核心中,这从来都不是问题,因为变更集永远不会被删除,但像 hgsubversion 和 mq 这样的扩展却打破了规则。

(如果您可以从 .hg/strip-backup 中的备份包中恢复剥离的变更集,则可以重新调整您的更改并再次剥离。)

It's effectively impossible to use a bundle without the bundle's precise parent changesets. Bundles consist of compact binary deltas that can only be applied to the precise binary source. There is no 'context' available that would allow Mercurial to guess how to apply them to other revisions the way patch does. In core Mercurial, this is never an issue because changesets are never removed, but extensions like hgsubversion and mq break the rules.

(If you can recover the stripped changesets from a backup bundle in .hg/strip-backup, you can then rebase your changes and strip again.)

迷雾森÷林ヴ 2024-12-13 16:04:22

背景:点击后hgsubversion 仅成功推送 1 个修订版的问题,我在提交中变得懒惰(如果您更新到要推送的最新修订版,则可以进行部分提交),并最终开始提交 一切。所以我取消了推送,第一次它没能保留我后来的修改。

我尝试恢复,但无法找到父提交。对我有用的是恢复 ...-backup.hg 文件(strip-backup 中也有一个 ...-temp.hg 文件)。

奇怪的事情(这就是我回答这个问题的原因)是它只给了我一个关于父母不在场的警告(我不知道为什么)......

warning: ignoring unknown working parent d5663567bc4b!
adding changesets
adding manifests
adding file changes
added 21 changesets with 1255 changes to 941 files
(run 'hg update' to get a working copy)

顺便说一句,我正在跑步水银版本2.0

Background: After hitting an issue with hgsubversion pushing only 1 revision successfully, I got lazy in my commits (partial commits are possible if you update to the latest revision you want to push), and ended up starting to commit everything. So I killed the push and for the first time it failed to keep my later revisions.

I tried recover, but that was not able to find the parent commit. What worked for me was restoring the ...-backup.hg file (there was a ...-temp.hg file in strip-backup too).

The strange thing (which is why I'm answering this) is that it only gave me a warning about the parent not being there (I have no idea why)...

warning: ignoring unknown working parent d5663567bc4b!
adding changesets
adding manifests
adding file changes
added 21 changesets with 1255 changes to 941 files
(run 'hg update' to get a working copy)

BTW, I'm running Mercurial version 2.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文