如何防止Mercurial补丁被拉?

Way*_*ner 4 version-control mercurial patch dvcs mercurial-queue

到目前为止,我还没有找到一个明确的答案,尽管答案可能是"改变你的工作流程".

我刚刚开始玩Mercurial的补丁队列,我可以看到它的一些重要力量.这看起来非常棒.在我的测试中,我发现如果你有一个补丁队列repo1,并且你从中拉出来repo2,你可以做一些坏事.例如:

  1. 创建repos 1并克隆它.
  2. 启用队列 repo1
  3. 做一些提交和一些补丁 repo1
  4. 将更改拉到 repo2
  5. repo1取消应用(弹出?)所有补丁
  6. 将更改拉到 repo2

现在你会看到两个不同的分支 - 从某个角度看是有道理的.然而,由于我的补丁不是repo1历史的一部分(至少在它们被应用之前),似乎应该有办法告诉mercurial我的补丁是禁止的,并且只提供"官方历史".

有没有办法做到这一点?

Tim*_*gan 8

Mercurial 阶段可能就是答案.

从Mercurial v2.1开始,您可以配置mq变更集以自动标记secret. 和命令secret忽略变更集.incoming/pulloutgoing/push

要启用此行为,您需要将以下内容添加到配置中:

[mq]
secret = True
Run Code Online (Sandbox Code Playgroud)

启用后,其行为如下:

$ hg qpush --all
applying my-patch
now at: my-patch

$ hg phase -r .
16873: secret

$hg outgoing
comparing with https://www.mercurial-scm.org/repo/hg
searching for changes
no changes found (ignored 1 secret changesets)
Run Code Online (Sandbox Code Playgroud)