# HG changeset patch # User Anton Shestakov # Date 1589862314 -28800 # Node ID 028e4ea75456537a37144cd970b760aa7a0b7830 # Parent 801bbfc4e2e8f40d68bada4f3f65f00c809feff6 topic: support foo#stack syntax diff -r 801bbfc4e2e8 -r 028e4ea75456 CHANGELOG --- 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 -------------------- diff -r 801bbfc4e2e8 -r 028e4ea75456 hgext3rd/topic/revset.py --- 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 diff -r 801bbfc4e2e8 -r 028e4ea75456 tests/test-topic-stack.t --- 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]' diff -r 801bbfc4e2e8 -r 028e4ea75456 tests/test-topic.t --- 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: