Mercurial-使用类似于货架的队列吗? [英] Mercurial - Working with Queues similar to Shelves?

查看:110
本文介绍了Mercurial-使用类似于货架的队列吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用MQ,因为我喜欢在隔离的补丁上工作并提交,而不会影响仓库的想法,直到变更集足够完善为止.在此之前,我曾经使用Mercurial的货架扩展架,但是发现它有点不稳定.我仍然想在MQ中弄清楚的是如何使修补程序彼此分开并以不特定的顺序以及在不同的分支中应用它们.这是我的正常流程-

I've recently started working with MQ as I like the idea of working on isolated patches and committing without affecting the repo until the changeset is refined enough. Before that, I used to work with Mercurial's shelves extension, but found it a bit unstable. What I'm still trying to figure out in MQ is how to keep patches separate from each other and apply them in no particular order, and across different branches. Here's my normal flow -

1..开始制作新补丁:

hg qnew fix-bug-1234 -m "fix bug 1234"
# do some work
hg qrefresh

2..获得要使用的新功能/错误:

2. Get a new feature/bug to work on:

hg qpop fix-bug-1234
hg qnew some-feature -m "implement feature X"
# some work on feature X (perhaps in a different branch)
hg qrefresh

3.至此,我想重新进行错误修复,并将功能工作搁置一旁.我认为这很简单:

3. At this point, I'd like to get back to working on bugfix, and put aside the feature work. I thought it's as simple as:

hg qpop some-feature
hg qpush fix-bug-1234
# wrap up bug fix
hg qfinish fix-bug-1234
# get back to work on feature

但是,MQ似乎总是使用该系列中创建的最新补丁,并且不管我使用的qpop/qpush命令如何都应用它.我应该注意,我处理的文件也是完全分开的(尽管有时它们可​​以相同).

However, MQ seems to always use the latest patch created in the series, and apply it regardless of the qpop/qpush command I'm using. I should note that the files I work on are completely separate as well (though they can sometimes be the same).

我在这里错过了什么吗?我应该为此使用hg qqueue吗?谢谢.

Am I missing something here? Should I be using hg qqueue for this? Thanks.

推荐答案

您可以使用

You could use guards. They allow you to maintain an ordering of patches without rearranging your series file, and selectively apply only a subset of patches, still in a stack-ordered fashion.

您所遇到的一个例子是:

An example in your case would be:

hg qnew bugfix
# ..hack hack..
hg qrefresh
# want to switch over to working on some feature now
hg qpop
hg qnew feature
# ..hack hack..
hg qrefresh

这时,您处于补丁feature在堆栈中的bugfix之前的情况.现在,您可以使用守卫选择一个或另一个,然后在两者之间切换:

At this point, you're in a situation where patch feature comes before bugfix in your stack. Now you can use guards to select one or the other, and switch between the two:

hg qpop -a
hg qguard feature +featureguard
hg qguard bugfix +bugfixguard

如果要使用feature:

hg qselect featureguard
hg qpush
applying feature
now at: feature

如果要使用bugfix:

hg qpop -a
hg qselect bugfixguard
hg qpush
applying bugfix
now at: bugfix

请注意,由于您选择了积极后卫 bugfixguard,因此MQ跳过了feature(因为它的积极后卫不同于所选的积极后卫),而是改用了补丁bugfix (与选定的后卫匹配).

Note that since you selected the positive guard bugfixguard, MQ leap-frogged over feature (because it's positive guard was different than the one selected) and applied the patch bugfix instead (which did match the selected guard).

使用防护功能时,一些有用的工具是hg qseries -v,它将显示G而不是通常的U(对于未应用防护的补丁),以及hg qselect -l将显示与每个补丁相关的防护.

Some useful tools when working with guards are hg qseries -v, which will display a G instead of the usual U for a guarded, unapplied patch, and hg qselect -l which will display the guards associated with each patch.

这篇关于Mercurial-使用类似于货架的队列吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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