diff hgext3rd/topic/stack.py @ 1977:137f8b04901e

topic: list the number of changesets when --verbose is used Displaying more information in the topic list is useful, we start with the most obvious: number of non-obsolete changeset in the topic.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 12 Aug 2016 23:59:37 +0200
parents d9c7fced94fc
children e42dd4523c0d
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py	Sun Aug 14 20:40:46 2016 +0200
+++ b/hgext3rd/topic/stack.py	Fri Aug 12 23:59:37 2016 +0200
@@ -64,6 +64,16 @@
         fm.plain('\n')
         fm.end()
 
+def stackdata(repo, topic):
+    """get various data about a stack
+
+    :changesetcount: number of non-obsolete changesets in the stack
+    """
+    data = {}
+    revs = repo.revs("topic(%s) - obsolete()", topic)
+    data['changesetcount'] = len(revs)
+    return data
+
 # Copied from evolve 081605c2e9b6
 
 def _orderrevs(repo, revs):