ISO Mercurial的“属性" -适用于多个变更集的标签,在变更集之后应用 [英] ISO Mercurial "attributes" - tags that apply to more than one changeset, applied after the changeset

查看:77
本文介绍了ISO Mercurial的“属性" -适用于多个变更集的标签,在变更集之后应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BRIEF

如何在Mercurial中使用相同的标签来标记多个变更集?可能在同一分支上,也可能在不同分支上.

How do I tag multiple changesets in Mercurial with the same tag? Possibly on the same branch, possibly on different branches.

例如像是标记,说明是否执行了完整的质量检查测试.

E.g. something like a tag that says whether the full QA test ran.

我可以通过编辑文件来创建标签的多个实例,但是hg工具几乎总是忽略除第一个以外的所有内容.

I can create multiple instances of a tag by editing the file, but the hg tools nearly always ignore all but the first.

详细信息

我正在寻找被称为变更集"的属性",这是我在其他CVS和DVCS中使用的概念,但是在Mercurial中似乎找不到.

I am looking for what I call changeset "attributes" - a concept that I have used in other CVS and DVCS, but which I cannot seem to find in Mercurial.

基本上,属性非常类似于标签,但是在标签仅应引用单个变更集的情况下,属性可以应用于多个变更集.

Basically, an attribute is very much like a tag, but where a tag is only supposed to refer to a single changeset, an attribute may apply to multiple changesets.

问:有人知道怎么做吗?

Q: does anyone know how to do this?

类似地:在创建变更集之后,是否可以将描述附加到变更集.请注意,我不想重写历史记录:我不想删除或更改或替换原始签入消息.我只想添加一些其他内容-并让更多的内容出现在诸如hg log之类的查询中.例如. 我忘记添加文件来提交df..a3-而是提交8f..77来检查丢失的文件.

Similarly: is there a way to attach a description to a ChangeSet, after the changeset has been created. Note that i do not want to rewrite history: I do not want to delete or change or replace the original checkin message. I just want to add some more stuff - and have that more stuff appear in queries like hg log. E.g. "I forgot to add a file to commit df..a3 - look instead to commit 8f..77 where I checked in the missing files.

详细信息

我知道-您可以执行hg tag -f强制将一个标签应用于多个变更集.但是许多其他与hg标签相关的功能实际上只能对每个标签进行一次更改.或每条血统至少只有一个变更集-即每人.

I know - you can do hg tag -f to force a tag to apply to more than one changeset. But so many other hg tag related features really only work with a single changesrty per tag. Or at least only one changeset per line of descent - i.e. per head.

因此,您可以永久定义标签.我喜欢将日期或其他上下文放在这样的标签中-例如tests-pass-2012-01-14.

So you can leave a tag defined forever and ever. I like placing the date or other context in such a tag - e.g. tests-pass-2012-01-14.

或者您可以使用一个向上浮动的浮动标签",例如所有慢速测试通过的最新版本",我可以简称为"tests-pass".

Or you can have a "floating tag", that moves upwards - e.g. "most recent rev where all the slow tests pass", which I might call simply "tests-pass".

(顺便说一句,您可以在签到后应用此类属性或标签-尤其是如果您的质量检查过程较慢,可能是快速冒烟测试,然后是较慢的全套测试,则可能需要一周的时间才能完成.所以您先签入,然后再回去应用属性,即带有唯一日期标记的标签,然后您可能需要回去修改这样的标签,例如是否添加了更多测试,以便过去能够通过的变更集所有测试都不再适用.例如all-tests-pass-2012-01-14和all-tests-pass-2012-01-15可能适用于同一变更集.)

(By the way, you may apply such attributes or tags after the checkin - especially if you have a slow QA process, perhaps a quick smoke test, followed by a slower full set of tests that may take a week to complete. So you checkin, and then, later, go back and apply the attribute, the uniqified dated tag. And you may later need to go back and modify such a tag, e.g. if more tests are added, so that a changeset that used to pass all tests no longer does. E.g. all-tests-pass-2012-01-14 and all-tests-pass-2012-01-15 may apply to the same changeset.)

但是必须统一这样的固定标签是很麻烦的.因此,我称之为属性:一个应用于多个变更集的标签,该标签受版本控制.因此,您可以将所有测试通行证应用到修订版105,然后再应用到106和107.但是随后您意识到新的测试在106上失败,因此您进行了回复.

But it is onerous to have to uniqify such fixed tags. Hence what I call an attribute: a tag that applies to multiple changesets, Which is version controlled. So you might apply all-tests-pass to rev 105, and then later to 106 and 107. But then you realize that new tests fail on 106, so you repally.

然后,属性历史记录可能看起来像

Then the attribute history might look like

105:
    tagged all-tests-pass on 2012-01-14-10h00 (in changeset XXX)
    tagged all-tests-pass on 2012-01-15-10h00 (in changeset YYY)

106:
    tagged all-tests-pass on 2012-01-14-13h00 (in changeset XXX)
    tagged not-all-tests-pass on 2012-01-15-13h00 (in changeset YYY)

107:
    tagged all-tests-pass on 2012-01-14-14h00 (in changeset XXX)
    tagged all-tests-pass on 2012-01-15-10h00 (in changeset YYY)

和类似revset的查询

and a revset query like

 105::107 and current_attribute_tag(all-tests-pass)

=最晚在仓库中YYY或之后返回105和107 =,但如果克隆后返回105、106、107,则不包含YYY

= returns 105 and 107 on the latest, at or after YYY is in the repo = but returns 105, 106, 107 if cloned so as not to include YYY

同时

 105::107 and attribute_tag_at_any_time(all-tests-pass)

=如果存储库保存XXX,则随时返回105106和107

=returns 105 106 and 107 at any time if the repo holds XXX

===

我希望能够做类似的事情

I would like to be able to do things like

  • 运行hg bisect,但仅在标记为tests-pass的变更集上运行.

  • run hg bisect, but only on changesets tagged tests-pass.

从hg日志和glog中排除某些日志消息

exclude certain log messages from hg log and glog

===

顺便说一句,出于这个目的,我拒绝阶段和书签,因为它们不受版本控制.而且我希望对这些属性标签进行VCed处理,以便如上所述,可以遵循所有测试通过的流程.

By the way, I reject phases and bookmarks for this purpose because they are not version controlled. And I want these attribute tags to be VCed, so that I can follow something like to ebb and flow of all-tests-pass, as mentioned above.

分支几乎是我想要的,因为Mercurial分支实际上是变更集属性,而不是分支.但是我认为与变更集关联的分支不能在提交后更改.

branches are almost what I want, because Mercurial branches are really changeset attributes, not branches. But I don't think that the branch associated with a changeset can be changed after the commit.

(我真的希望您可以在提交变更集后将其切换到分支.我将此功能称为追溯分支".)

(I really wish that you could switch changesets to a branch after you commit them. I call this wished for feature "retroactive branching".)

===

这是为什么我想要属性的经典示例:您是否曾经忘记将文件添加到VCS?然后有一个构建失败的变更集?在随后的changest中添加文件? ...

Here's a classic example of why I might want attributes: have you ever forgotten to add a file to the VCS? And then have a changeset that fails to build? Add the file in a subsequent changest? ...

我希望能够将变更集追溯标记为will-not-build-missing-files.然后让bisect甚至不用理会这些变更集.

I would like to be able to retroactively mark a changeset as will-not-build--missing-files. And then have bisect not even bother looking at such changesets.

推荐答案

看看这个: Mercurial中的自定义修订版属性?

没有对属性的本地支持.您可以编写一个扩展名(有一个extra属性的字典,该字典随变更集一起保存).

There's no native support for attributes. You could write an extension (there's a dictionary of extra properties that get saved with a changeset).

或者您也可以将其与每个标记的多个变更集一起使用(如您建议的那样).

Or you could hack it together with multiple changesets per tag (as you suggested).

或者您可以将其与新的all-tests-pass分支一起破解,并在所有测试通过时将您的CI服务器合并到该分支(然后,二等分是默认的技巧和all-tests-pass的技巧).

Or you could hack it together with a new all-tests-pass branch, and have your CI server merge to that branch when all tests pass (then bisects are being tip of default and tip of all-tests-pass).

但是简短的答案仍然是,尚无现有的本机方法.

But the short answer remains that there's no existing native way to do it.

这篇关于ISO Mercurial的“属性" -适用于多个变更集的标签,在变更集之后应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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