diff hgext3rd/topic/revset.py @ 2669:b933a8068c17

topic: add some initial support for using stack on named branch Stack is a useful command that can make sense in other context. The current support is hacky and awful, but we have something!
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 28 Jun 2017 02:45:57 +0200
parents 1d2c66dc4ee3
children aa4db71a6224
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py	Wed Jun 28 01:58:09 2017 +0200
+++ b/hgext3rd/topic/revset.py	Wed Jun 28 02:45:57 2017 +0200
@@ -75,7 +75,13 @@
     if not topic:
         raise error.Abort(_('no active topic to list'))
     # ordering hack, boo
-    return revset.baseset(stack.getstack(repo, topic=topic)) & subset
+    topic = None
+    branch = None
+    if not topic and repo.currenttopic:
+        topic = repo.currenttopic
+    if not topic:
+        branch = repo[None].branch()
+    return revset.baseset(stack.getstack(repo, branch=branch, topic=topic)) & subset
 
 
 def modsetup(ui):