Mercurial:此变更集何时在稳定分支中生效?
Mercurial: when did this changeset take effect in the stable-branch?
场景:一位同事告诉我,我修复的错误不在当前版本中。我说:"but I pushed it 2 weeks ago!"
我如何检查我的更改(提交到错误修复分支)是否已合并到稳定分支并推送到服务器存储库?
所以这真的有 3 个部分:
1) 提交了吗?什么时候?查看修订号:
hg blame FILENAME
查看带有日期等的日志:
hg log REVISION
2) 合并了吗?
hg glog -r "(merge() and branch(2.5) and children(branch('BRANCHNAME')))" \
--template "{branches} [{rev}] ({date|shortdate}): {desc|firstline}\n"
能再短一点吗?
3) 被推送了吗?
它可以更短更简洁(在某些条件下)
任务 1
如果你能回忆起你在任何文件中拼凑的任何字符串的任何部分 - hg help grep
。 F.e(模式是正则表达式,因此 - 括号被转义以处理 "as is"):
>hg grep "repo\[None\].parents()" test_hooks.py
tests/test_hooks.py:1417: state = repo[None].parents()
输出中的第二个字段(易于自动处理解析)是变更集,其中此更改是在此文件[=中进行的26=]
任务 2
只修复相当脏(并且在公共逻辑中很糟糕)的 revset:
与 merge() and branch(DST) and children(branch('SRC'))
一起,您将获得用于合并 SRC -> DST 的所有合并集,甚至 与已知的错误修复修订集无关 。上述存储库和您的 revset 的输出(注意还略微更改了命令 - hg glog
已弃用)
>hg log -g -r "(merge() and branch(default) and children(branch('stable')))" --template "{branches} [{rev}] ({date|shortdate}): {desc|firstline}\n"
[839] (2011-10-19): Merge with stable.
[841] (2011-10-21): Merge with stable.
[843] (2011-11-01): Merge with stable
[982] (2012-11-11): Merge with stable.
[1021] (2013-06-23): Merge with stable.
[1108] (2014-02-11): Merge with stable.
[1126] (2014-02-12): Merge with stable.
[1171] (2014-04-04): Merge with stable.
[1180] (2014-05-02): Merge with stable.
[1228] (2014-08-01): Merge with stable.
[1231] (2014-08-12): Merge with stable.
[1257] (2014-11-05): Merge stable back into default.
[1266] (2014-11-15): Merge with stable.
[1280] (2014-12-10): Merge with stable.
[1307] (2015-01-30): Merge with stable.
[1326] (2015-05-08): Merge stable back into default.
[1335] (2015-05-29): Merge with stable.
[1338] (2015-07-08): Merge with stable.
[1341] (2015-07-09): Merge with stable.
[1346] (2015-08-11): Merge with stable.
[1349] (2015-09-26): Merge with stable.
[1358] (2015-09-30): Merge with stable.
[1362] (2015-10-21): Merge with stable.
[1367] (2015-12-31): Merge with stable.
[1372] (2016-01-27): Merge with stable.
[1378] (2016-03-04): Merge with stable.
[1410] (2016-05-11): Merge with stable.
[1418] (2016-05-23): Merge with stable.
[1489] (2016-06-26): Merge with stable.
我从简单的 descendants(1417)
开始(贪心 revset,是的)
>hg log -r "descendants(1417)" -T "{rev}\n"
1417
1418
1419
1420
1421
...
因为我只对合并到 default
感兴趣(在我的例子中)可能更短的输出将是 hg log -r "descendants(1417) and branch(default)"
(但它也可能相当长 - 我真的消除了两个 revsets)并且只需要列表中的第一个 revset
>hg log -r "first(descendants(1417) and branch(default))" -T "{rev}\n"
1418
或者以稍微不同的方式(回顾合并集实体,也可以是 first()-ed)
>hg log -r "merge() and descendants(1417) and branch(default)" -T "{rev}\n"
1418
1489
备注:
- p.3 的解决方案 - 在 CENTRAL-REPO 克隆上执行所有测试(您已经拥有,是的)
- "Bad logic" 备注 -
branch(2.5) and children(branch('BRANCHNAME')
通过设计仅提取 2.5 中的合并集,merge()
不应用任何额外的 effective 过滤器
附录:
经过一些(仍然未完成的)头痛之后,我得到了上面的命令作为别名的两个参数:有问题的变更集和目标分支。有点像
[alias]
ismerged = log -r "first(descendants() and branch(''))" --template "{ifeq(branch, '', 'Merged in {rev}','Not merged')}\n"
在回购的 .hgrc
合并变更集的输出
>hg ismerged 62 default
Merged in 63
但我无法让 else-part 为未合并的变更集工作,并且在这种情况下仍然有愚蠢的空输出
未来(装饰性而非功能性)改进可能包括:
- 正在将 revset 定义从别名转移到`[revsetalias]
- 做好模板的其他部分
场景:一位同事告诉我,我修复的错误不在当前版本中。我说:"but I pushed it 2 weeks ago!"
我如何检查我的更改(提交到错误修复分支)是否已合并到稳定分支并推送到服务器存储库?
所以这真的有 3 个部分:
1) 提交了吗?什么时候?查看修订号:
hg blame FILENAME
查看带有日期等的日志:
hg log REVISION
2) 合并了吗?
hg glog -r "(merge() and branch(2.5) and children(branch('BRANCHNAME')))" \
--template "{branches} [{rev}] ({date|shortdate}): {desc|firstline}\n"
能再短一点吗?
3) 被推送了吗?
它可以更短更简洁(在某些条件下)
任务 1
如果你能回忆起你在任何文件中拼凑的任何字符串的任何部分 - hg help grep
。 F.e(模式是正则表达式,因此 - 括号被转义以处理 "as is"):
>hg grep "repo\[None\].parents()" test_hooks.py
tests/test_hooks.py:1417: state = repo[None].parents()
输出中的第二个字段(易于自动处理解析)是变更集,其中此更改是在此文件[=中进行的26=]
任务 2
只修复相当脏(并且在公共逻辑中很糟糕)的 revset:
与 merge() and branch(DST) and children(branch('SRC'))
一起,您将获得用于合并 SRC -> DST 的所有合并集,甚至 与已知的错误修复修订集无关 。上述存储库和您的 revset 的输出(注意还略微更改了命令 - hg glog
已弃用)
>hg log -g -r "(merge() and branch(default) and children(branch('stable')))" --template "{branches} [{rev}] ({date|shortdate}): {desc|firstline}\n"
[839] (2011-10-19): Merge with stable.
[841] (2011-10-21): Merge with stable.
[843] (2011-11-01): Merge with stable
[982] (2012-11-11): Merge with stable.
[1021] (2013-06-23): Merge with stable.
[1108] (2014-02-11): Merge with stable.
[1126] (2014-02-12): Merge with stable.
[1171] (2014-04-04): Merge with stable.
[1180] (2014-05-02): Merge with stable.
[1228] (2014-08-01): Merge with stable.
[1231] (2014-08-12): Merge with stable.
[1257] (2014-11-05): Merge stable back into default.
[1266] (2014-11-15): Merge with stable.
[1280] (2014-12-10): Merge with stable.
[1307] (2015-01-30): Merge with stable.
[1326] (2015-05-08): Merge stable back into default.
[1335] (2015-05-29): Merge with stable.
[1338] (2015-07-08): Merge with stable.
[1341] (2015-07-09): Merge with stable.
[1346] (2015-08-11): Merge with stable.
[1349] (2015-09-26): Merge with stable.
[1358] (2015-09-30): Merge with stable.
[1362] (2015-10-21): Merge with stable.
[1367] (2015-12-31): Merge with stable.
[1372] (2016-01-27): Merge with stable.
[1378] (2016-03-04): Merge with stable.
[1410] (2016-05-11): Merge with stable.
[1418] (2016-05-23): Merge with stable.
[1489] (2016-06-26): Merge with stable.
我从简单的 descendants(1417)
开始(贪心 revset,是的)
>hg log -r "descendants(1417)" -T "{rev}\n"
1417
1418
1419
1420
1421
...
因为我只对合并到 default
感兴趣(在我的例子中)可能更短的输出将是 hg log -r "descendants(1417) and branch(default)"
(但它也可能相当长 - 我真的消除了两个 revsets)并且只需要列表中的第一个 revset
>hg log -r "first(descendants(1417) and branch(default))" -T "{rev}\n"
1418
或者以稍微不同的方式(回顾合并集实体,也可以是 first()-ed)
>hg log -r "merge() and descendants(1417) and branch(default)" -T "{rev}\n"
1418
1489
备注:
- p.3 的解决方案 - 在 CENTRAL-REPO 克隆上执行所有测试(您已经拥有,是的)
- "Bad logic" 备注 -
branch(2.5) and children(branch('BRANCHNAME')
通过设计仅提取 2.5 中的合并集,merge()
不应用任何额外的 effective 过滤器
附录:
经过一些(仍然未完成的)头痛之后,我得到了上面的命令作为别名的两个参数:有问题的变更集和目标分支。有点像
[alias]
ismerged = log -r "first(descendants() and branch(''))" --template "{ifeq(branch, '', 'Merged in {rev}','Not merged')}\n"
在回购的 .hgrc
合并变更集的输出
>hg ismerged 62 default
Merged in 63
但我无法让 else-part 为未合并的变更集工作,并且在这种情况下仍然有愚蠢的空输出
未来(装饰性而非功能性)改进可能包括:
- 正在将 revset 定义从别名转移到`[revsetalias]
- 做好模板的其他部分