如何在存储库内外交换Mercurial队列 [英] How to swap Mercurial Queues in and out of a repository

查看:93
本文介绍了如何在存储库内外交换Mercurial队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个称为"Simulator"的平台无关商品代码存储库

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 Experiment.patch + windows
  • Unix Experiment.patch + unix
  • Mac Experiment.patch + mac

但是它开始变得麻烦,因为我们的补丁程序队列包含100多个补丁程序,例如Windows-memory-optimization.patch + windows,unix-memory-optimization.patch + unix,windows-io-experimental-bug-fix.patch. + windows等.我们在系列文件中将其组织为组,但是文件越来越大,并且使用qseries/qapplied变得难以管理

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

相反,我们希望Windows,Unix和Mac排队.

Instead we would like to have a queue for windows, unix and 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修补程序堆栈来进行处理.

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.

除了为每个平台制作3个不同的存储库并以这种方式维护补丁程序堆栈外,我似乎无法做到这一点.

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.

除了手动将.hg/patches目录复制到存储库中以及从存储库中复制目录之外,是否有其他方法可以完成交换"补丁程序堆栈?

Is there a way to, other than manually copying the .hg/patches directory in and out of the repo, to accomplish "swapping" patch stacks?

推荐答案

Mercurial队列的有趣用法:)

Interesting use of Mercurial Queues :)

我在这里假设您已经在某些地方对Mercurial队列进行了版本控制.如果您不知道/不知道该怎么做,请查看

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.

应该有可能维护三个不同的在您的MQ存储库中为每个平台命名一个分支.

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.

(带有alias mq='hg -R $(hg root)/.hg/patches')

首先创建一个Windows分支:

$ mq branch windows
marked working directory as branch windows

已创建,但尚未提交.

created, but not yet committed.

做一些事情,添加补丁:

$ hg qnew windowspatch
... do some stuff

刷新,弹出并提交:

$ hg qref
$ hg qpop -a
$ mq ci -m 'new windows branch'

您现在拥有默认分支和新的Windows分支:

You now have the default branch and the new windows branch:

$ mq branches
windows                       65:5fd4ef0b96c9
default                       64:06c1a56a3c08 (inactive)

现在创建一个Unix分支.

首先切换回基本默认分支:

First switch back to the base default branch:

$ mq up default
1 files updated, 0 files merged, 1 files removed, 0 files unresolved

创建一个新的unix分支并添加一个unix特定的修补程序:

Create a new unix branch and add a unix-specific patch:

$ mq branch unix
marked working directory as branch unix
$ hg qnew unixpatch
... blahblah
$ hg qref
$ hg qpop -a
$ mq ci -m 'adding unix branch'
$ mq branches
unix                          66:c51bb2c7b413
windows                       65:5fd4ef0b96c9
default                       64:06c1a56a3c08 (inactive)

用法

在对mq存储库进行操作之前,请不要忘记qpop -a ...

Usage

Don't forget to qpop -a before operating on the mq repos...

推送所有Windows补丁

Push all the windows patches

$ mq up windows
xx files updated, yy files merged, zz files removed, ww files unresolved
$ hg qpush -a

三个物理仓库

维护三个独立的(Mercurial队列)分支看起来有些吓人.如果是这样,您可以只使用三个不同的MQ存储库:每个平台一个,每个版本在不同的地方进行版本控制.

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.

例如:

$ cd mqs
$ hg qclone mq-windows windows
$ hg qclone mq-unix unix
$ hg qclone mq-mac mac

要在不同平台上工作,只需切换文件夹(存储库).该概念类似于第一种方法.但是,您可以使用三个单独的MQ回购协议,而不是在一个MQ回购协议中拥有三个内部分支.

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.

这篇关于如何在存储库内外交换Mercurial队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆