diff hglib/context.py @ 126:a7fe976b1931

context: add 'phase' getter This method must be dynamic as the phase can change during the lifetime of the changeset.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Wed, 21 May 2014 12:25:30 +0200
parents cc7569bffb26
children 1b47146a4a2c
line wrap: on
line diff
--- a/hglib/context.py	Fri May 16 18:21:12 2014 +0200
+++ b/hglib/context.py	Wed May 21 12:25:30 2014 +0200
@@ -199,6 +199,10 @@
         return bool(self._repo.log(revrange='%s and hidden()' % self._node,
                                    hidden=True))
 
+    def phase(self):
+        """return the phase of the changeset (public, draft or secret)"""
+        return self._repo.phase(str(self._rev))[0][1]
+
     def children(self):
         """return contexts for each child changeset"""
         for c in self._repo.log('children(%s)' % self._node):