在 Mercurial 中,如何仅查看一组修订而不是全部修订的标签?

发布于 2024-10-08 23:25:03 字数 213 浏览 0 评论 0原文

hg Tags 始终显示所有标签,那么如何才能仅获取指向特定修订版及其所有祖先的标签呢?

现实世界的用例是,如果我使用本地标签来指定变更集上的功能(或错误修复),并且我需要找出特定版本之前的累积功能/错误。

一种解决方案是添加一个包装器命令,将“-r”添加到标签。那么最好的实施方式是什么?使用转速集获取所有祖先转速并过滤标签?

hg tags always shows all tags, so how can I get only the tags that point to a specific revision and all its ancestors?

The real-world use case is that if I use local tags to designate features (or bug fixes) on changesets, and I need to find out the cumulative features/bugs up till a specific rev.

One solution would be adding a wrapper command that adds "-r" to tags. Then what's the best way to implement it? Use revsets to get all ancestral revs and filter the tags?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舟遥客 2024-10-15 23:25:04

如果我理解正确的话,您想要:

  • 指定修订版
  • 过滤日志,使其仅包含该变更集及其所有祖先
  • 提取这些变更集中的所有标签

如果您可以将自己限制为标签名称,则可以做到这一点:

hg log -r "ancestors(HASH)" --template "{tags}"

If I understand you correctly, you want to:

  • Specify a revision
  • Filter the log to only that changeset + all its ancestors
  • Extract all tags that are in those changesets

You can do that if you can limit yourself to tag names:

hg log -r "ancestors(HASH)" --template "{tags}"
递刀给你 2024-10-15 23:25:03

这应该可以解决问题(需要 Mercurial 1.7):

hg log -r "ancestors(<rev>) and tag()"

其中 是哈希值或本地修订号。然而,标记每个错误修复和功能似乎有点矫枉过正。

您可以遵循在提交消息中放置“bugfix: xyz”或“feature: abc”的约定,而不是标记。然后,您可以提取所有错误修复和功能,如下所示:

hg log -r "ancestors(<rev>) and (keyword(bugfix) or keyword(feature))"

为重要里程碑或具有特殊意义的其他修订保留标签。

This should do the trick (requires mercurial 1.7):

hg log -r "ancestors(<rev>) and tag()"

where <rev> is the hash or local revision number. However, tagging every bugfix and feature seems overkill.

Instead of tagging, you can just follow a convention where you put "bugfix: xyz" or "feature: abc" in your commit messages. You can then extract all bugfixes and features like this:

hg log -r "ancestors(<rev>) and (keyword(bugfix) or keyword(feature))"

Keep tags for important milestones or other revisions that have some special significance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文