diff hgext3rd/topic/stack.py @ 2936:3a9303b7b648

topics: show working directory branch when topic is empty
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 15 Sep 2017 22:48:55 +0530
parents 5b514ab2ab4e
children b54abc7e80e2
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Fri Sep 01 15:09:59 2017 +0530
+++ b/hgext3rd/topic/stack.py	Fri Sep 15 22:48:55 2017 +0530
@@ -169,7 +169,10 @@
 
     @util.propertycache
     def branches(self):
-        return sorted(set(self._repo[r].branch() for r in self._revs))
+        branches = sorted(set(self._repo[r].branch() for r in self._revs))
+        if not branches:
+            branches = set([self._repo[None].branch()])
+        return branches
 
 def labelsgen(prefix, labelssuffix):
     """ Takes a label prefix and a list of suffixes. Returns a string of the prefix