Mercurial > evolve
diff 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 |
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py Thu Jan 10 17:30:01 2019 +0100 +++ b/hgext3rd/topic/revset.py Wed Dec 26 14:52:07 2018 +0800 @@ -142,3 +142,16 @@ revset.subscriptrelations['stack'] = stackrel revset.subscriptrelations['s'] = stackrel + + def topicrel(repo, subset, x, rel, n, order): + ancestors = revset._ancestors + descendants = revset._descendants + subset = topicset(repo, subset, x) + if n <= 0: + n = -n + return ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1) + else: + return descendants(repo, subset, x, startdepth=n, stopdepth=n + 1) + + revset.subscriptrelations['topic'] = topicrel + revset.subscriptrelations['t'] = topicrel