144 return subset & revset.baseset(revs) |
144 return subset & revset.baseset(revs) |
145 |
145 |
146 revset.subscriptrelations['stack'] = stackrel |
146 revset.subscriptrelations['stack'] = stackrel |
147 revset.subscriptrelations['s'] = stackrel |
147 revset.subscriptrelations['s'] = stackrel |
148 |
148 |
149 def topicrel(repo, subset, x, rel, n, *args): |
149 def topicrel(repo, subset, x, *args): |
150 # hg 5.0 provides two bounds, for now we support only one |
150 subset &= topicset(repo, subset, x) |
151 if len(args) == 2 and args[0] != n: |
151 return revset.generationsrel(repo, subset, x, *args) |
152 raise NotImplementedError |
|
153 ancestors = revset._ancestors |
|
154 descendants = revset._descendants |
|
155 subset = topicset(repo, subset, x) |
|
156 if n <= 0: |
|
157 n = -n |
|
158 return ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1) |
|
159 else: |
|
160 return descendants(repo, subset, x, startdepth=n, stopdepth=n + 1) |
|
161 |
152 |
162 revset.subscriptrelations['topic'] = topicrel |
153 revset.subscriptrelations['topic'] = topicrel |
163 revset.subscriptrelations['t'] = topicrel |
154 revset.subscriptrelations['t'] = topicrel |