如何将 Mercurial 队列调入和调出存储库
我有一个名为“Simulator”的平台中立的 Mercurial 代码存储库
,并且希望在构建之前应用针对特定平台优化的补丁。
根据指南,我们可以通过使用带有防护的补丁来实现这一点。
- Windows Experimental.patch +windows
- Unix Experimental.patch +unix
- Mac Experimental.patch +mac
但是,它开始变得麻烦,因为我们的补丁队列包含 100 多个名为 windows-memory-optimization.patch +windows、unix-memory-optimization 的补丁。 patch +unix、windows-io-experimental-bug-fix.patch +windows 等。我们将其组织为系列文件中的组,但文件变得越来越大,并且使用 qseries / qapplied 变得难以管理。
相反,我们希望有一个适用于 windows、unix 和 mac 的队列。
因此,补丁可以组织为:
- Windows 补丁堆栈:memory-opt.patch、io-opt.patch 等
- Unix 补丁堆栈:disk.patch、graphics.patch 等
- Mac 补丁堆栈:io-fix.patch、io- opt.patch、experimental.patch 等
然后将每个平台的补丁堆栈交换进出模拟器存储库。 这样我就可以处理 Windows 补丁堆栈并弹出/推送各种子系统优化补丁,并独立于 unix 或 mac 补丁堆栈来处理它们。
除了针对每个平台制作 3 个不同的存储库并以这种方式维护补丁堆栈之外,我似乎无法做到这一点。
除了手动将 .hg/patches 目录复制到存储库中或从存储库中复制出来之外,还有其他方法可以完成“交换”补丁堆栈吗?
I have a platform neutral mercurial code repo called "Simulator"
and want to apply patches that target specific platform's optimizations before a build.
According to the guide we can accomplish this by the use of patches with guards.
- Windows Experimental.patch +windows
- Unix Experimental.patch +unix
- Mac Experimental.patch +mac
However its starting to get cumbersome because our patch queue contains 100+ patches named like windows-memory-optimization.patch +windows, unix-memory-optimization.patch +unix, windows-io-experimental-bug-fix.patch +windows, etc etc. We organized it as groups in the series file, but the file is getting huge and using qseries / qapplied is getting unmanageable
Instead we would like to have a queue for windows, unix and mac.
So that patches can be organized as:
- Windows Patch Stack: memory-opt.patch, io-opt.patch, etc
- Unix Patch Stack: disk.patch, graphics.patch, etc
- Mac Patch Stack: io-fix.patch, io-opt.patch, experimental.patch, etc
Then swap the patch stacks for each platform in and out of the simulator repo. So that I can work on the windows patch stack and pop/push various subsystem optimization patches and work on them independently of the unix or mac patch stacks.
It does not look like I can do that, other than making 3 different repos specific to the each platform and maintaining the patch stacks that way.
Is there a way to, other than manually copying the .hg/patches directory in and out of the repo, to accomplish "swapping" patch stacks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Mercurial 队列的有趣用法:)
我假设您已经在某处对 Mercurial 队列进行版本控制。 如果您不/不知道如何执行此操作,请查看 hgbook 的相关部分:这是在不应用补丁的情况下逐步协作/保存工作的好方法。
三个命名分支
应该可以维护三个不同的 MQ 存储库中的命名分支,每个平台一个。
要切换平台,只需切换活动分支即可。
(使用
alias mq='hg -R $(hg root)/.hg/patches'
)首先创建一个Windows分支:
已创建,但尚未提交。
做一些事情,添加补丁:
刷新、弹出并提交:
您现在拥有默认分支和新的 Windows 分支:
现在创建一个 Unix 分支。 strong>
首先切换回基本默认分支:
创建一个新的 unix 分支并添加特定于 unix 的补丁:
用法
在操作 mq 存储库之前不要忘记
qpop -a
。 ..推送所有 Windows 补丁
三个物理存储库
维护三个独立的(水银队列)分支可能看起来有点可怕。 如果是这样,您可以只使用三个不同的 MQ 存储库:每个平台一个,每个存储库的版本位于不同的位置。
例如:
要在不同平台上工作,只需切换文件夹(repos)即可。 该概念与第一种方法类似。 但是,您可以使用三个独立的 MQ 存储库,而不是在一个 MQ 存储库中拥有三个内部分支。
Interesting use of Mercurial Queues :)
I assume here that you are already versioning your mercurial queues somewhere. If you don't/for those that don't know how to do this, have a look at the relevant section from the hgbook: it's a great way to collaborate/save incrementally your work without applying the patches.
Three named branches
It should be possible to maintain three different named branches, one for each platform, in your MQ repository.
To switch platform, just switch the active branch.
(with
alias mq='hg -R $(hg root)/.hg/patches'
)First create a windows branch:
created, but not yet committed.
Do some stuff, add patches:
Refresh, pop and commit:
You now have the default branch and the new windows branch:
Now create an Unix branch.
First switch back to the base default branch:
Create a new unix branch and add a unix-specific patch:
Usage
Don't forget to
qpop -a
before operating on the mq repos...Push all the windows patches
Three physical repos
Maintaining three separate (mercurial queue) branches can look a bit scary. If so, you can just use three different MQ repositories: one for each platform, each of them versioned in a different place.
For example :
To work on different platforms, just switch folders (repos). The concept is similar to the first approach. But instead of having three internal branches in one MQ repo, you use three separate MQ repos.
要为“mq”创建等效的 Windows 别名,请在与“hg.exe”相同的目录中创建一个批处理文件(例如“C:\Program Files\TortoiseHg”),将其命名为“mq.cmd”,然后粘贴此文件代码:
To make an equivalent Windows alias for "mq", create a batch file in the same directory as "hg.exe" (e.g., "C:\Program Files\TortoiseHg"), name it "mq.cmd", and paste this code:
我知道这个问题已经很老了,但可能有人有兴趣知道还有另一种解决方案。 我认为在提出问题时这是不可能的,但这里有关于这种情况的更多信息:MQ 上的多个补丁队列
I know this question is old, but may be someone could be interested to know there's another solution. I think this wasn't possible at the time the question got asked, but here it is more info regarding this situation: Multiple Patch Queues on MQ