Mercurial > evolve
changeset 5333:028e4ea75456
topic: support foo#stack syntax
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 19 May 2020 12:25:14 +0800 |
parents | 801bbfc4e2e8 |
children | 498dc93c3fa0 |
files | CHANGELOG hgext3rd/topic/revset.py tests/test-topic-stack.t tests/test-topic.t |
diffstat | 4 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG Tue May 19 12:23:29 2020 +0800 +++ b/CHANGELOG Tue May 19 12:25:14 2020 +0800 @@ -1,6 +1,13 @@ Changelog ========= +10.1.0 - in progress +-------------------- + +topic (0.20.0) + + * stack: support foo#stack relation revset (hg-5.4+ only) + 10.0.0 -- 2020-05-09 --------------------
--- a/hgext3rd/topic/revset.py Tue May 19 12:23:29 2020 +0800 +++ b/hgext3rd/topic/revset.py Tue May 19 12:25:14 2020 +0800 @@ -172,3 +172,13 @@ revset.subscriptrelations[b'topic'] = topicrel revset.subscriptrelations[b't'] = topicrel + + # x#y revset operator support (no support for older version) + # hg <= 5.3 (eca82eb9d777) + if util.safehasattr(revset, 'relations'): + def stackrel(repo, subset, x, rel, order): + z = (b'rangeall', None) + return stacksubrel(repo, subset, x, rel, z, order) + + revset.relations[b'stack'] = stackrel + revset.relations[b's'] = stackrel
--- a/tests/test-topic-stack.t Tue May 19 12:23:29 2020 +0800 +++ b/tests/test-topic-stack.t Tue May 19 12:25:14 2020 +0800 @@ -385,6 +385,14 @@ hg: parse error: stack takes no arguments, it works on current topic [255] +Stack relation: + + $ hg log -r 'foo#stack' + 2 default {foo} draft c_c + 4 default {foo} draft c_e + 5 default {foo} draft c_f + 6 default {foo} draft c_d + Stack relation subscript: $ hg log -r 'foo#stack[0]'
--- a/tests/test-topic.t Tue May 19 12:23:29 2020 +0800 +++ b/tests/test-topic.t Tue May 19 12:25:14 2020 +0800 @@ -910,6 +910,10 @@ ^ 3 s1: 0 + $ tlog 'tip#s' + 0: + 4: + $ tlog 'tip#stack[0]' $ tlog 'tip#stack[1]' 0: @@ -928,6 +932,11 @@ s1: 1 s0^ 0 (base) + $ tlog 'featureA#s' + 1: featureA + 2: featureA + 3: featureA + $ tlog 'featureA#s[0]' 0: $ tlog 'featureA#s[0:0]' @@ -978,6 +987,7 @@ ### target: default (branch) (stack is empty) s0^ 4 (base current) + $ tlog 'wdir()#s' $ tlog 'wdir()#s[0]' 4: