Mercurial:查看分支与默认分支合并的频率

发布于 2024-11-15 04:44:37 字数 731 浏览 0 评论 0原文

假设我有两个分支,default 和 mybranch,我想编写一个小脚本来查看:

  1. mybranch 与 default 合并的频率(更改从 mybranch 到 default)
  2. mybranch 从 default 合并的频率(更改从 default 变为默认) mybranch)

#1 的一些伪代码:

    m_lastmergetime = 0
    for each m in [all merges with default from mybranch]
        m_mergetime = m.date_in_hours
        m_timebetweenmerges = m_mergetime - m_lastmergetime
        if m_lastmergetime > 0
            print m_timebetweenmerges

Sub.steps:

  1. 一个 Mercurial 查询,它与 mybranch 中的默认值匹配所有合并
  2. Mercurial 的样式,显示以小时为单位的日期
  3. 计算合并之间的时间,如上面所示使用 Bash 或 Python 的伪代码

案例 #2 非常相似。我只需要:

  1. 一个 Mercurial 查询,它与默认情况下与 mybranch 的所有合并相匹配

Let´s say I have two branches, default and mybranch, I would like to write a small script to see:

  1. How often mybranch merges with default (changes goes from mybranch to default)
  2. How often mybranch merges from default (changes goes from default into mybranch)

Some pseudocode for #1:

    m_lastmergetime = 0
    for each m in [all merges with default from mybranch]
        m_mergetime = m.date_in_hours
        m_timebetweenmerges = m_mergetime - m_lastmergetime
        if m_lastmergetime > 0
            print m_timebetweenmerges

Sub.steps:

  1. A Mercurial query which matches all merges with default from mybranch
  2. A style for Mercurial which shows the date in hours
  3. Calculate the time between merges as in the above pseudocode using Bash or Python

Case #2 will be pretty similar. I only need:

  1. A Mercurial query which matches all merges with mybranch from default

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

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

发布评论

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

评论(1

可遇━不可求 2024-11-22 04:44:37

要查找分支 X 上从分支 Y 合并的所有变更集,您可以发出以下 Mercurial 命令:

hg log --rev "children(branch(X)) and children(branch(Y)) and branch(X)"

要查找分支 Y 上从分支 X 合并的所有内容(即相反方向),只需更改最后一个分支名称Y:

hg log --rev "children(branch(X)) and children(branch(Y)) and branch(Y)"
                              ^                       ^              ^
                              +------ leave these ----+              |
                                                                     |
                                      but change this ---------------+

基本上,查询表示您希望所有变更集:

  • 是分支 X 上任何变更集的子级
  • 也是分支 Y 上任何变更集的子级(只有合并变更集有两个父级,因此可以是两个分支上的变更集的子级同时)
  • 分支 Y(因此您将合并到分支 Y)

To find all the changesets on branch X that was merged in from branch Y you would issue the following Mercurial command:

hg log --rev "children(branch(X)) and children(branch(Y)) and branch(X)"

To find everything on branch Y that was merged in from branch X (ie. the opposite direction), simply change the last branch name there to Y:

hg log --rev "children(branch(X)) and children(branch(Y)) and branch(Y)"
                              ^                       ^              ^
                              +------ leave these ----+              |
                                                                     |
                                      but change this ---------------+

Basically the query says that you want all changesets that:

  • is a child of any of the changesets on branch X
  • is also a child of any of the changesets on branch Y (only merge changesets have two parents, and can thus be a child of changesets on two branches at the same time)
  • is on branch Y (so you merged to branch Y)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文