comparison hgext3rd/topic/revset.py @ 4339:0f015fe4f71f

topic: make revsets like 'foo#topic[0]' work Essentially, 'topic' relation subscript function is the same as 'generations', but is limited to revisions marked with one particular topic.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 26 Dec 2018 14:52:07 +0800
parents 482992803db6
children 75276f858444
comparison
equal deleted inserted replaced
4338:e2350851740a 4339:0f015fe4f71f
140 revs.append(rev) 140 revs.append(rev)
141 return subset & revset.baseset(revs) 141 return subset & revset.baseset(revs)
142 142
143 revset.subscriptrelations['stack'] = stackrel 143 revset.subscriptrelations['stack'] = stackrel
144 revset.subscriptrelations['s'] = stackrel 144 revset.subscriptrelations['s'] = stackrel
145
146 def topicrel(repo, subset, x, rel, n, order):
147 ancestors = revset._ancestors
148 descendants = revset._descendants
149 subset = topicset(repo, subset, x)
150 if n <= 0:
151 n = -n
152 return ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1)
153 else:
154 return descendants(repo, subset, x, startdepth=n, stopdepth=n + 1)
155
156 revset.subscriptrelations['topic'] = topicrel
157 revset.subscriptrelations['t'] = topicrel