phabricator: color the status in the "phabstatus" view
authorMatt Harbison <matt_harbison@yahoo.com>
Fri, 22 Nov 2019 23:43:59 -0500
changeset 43858 b0867b7751ba
parent 43857 74ec6ca0eb75
child 43859 8766728dbce6
phabricator: color the status in the "phabstatus" view I couldn't figure out strikethrough for "abandoned" like I've see with word diff. Differential Revision: https://phab.mercurial-scm.org/D7608
hgext/phabricator.py
--- a/hgext/phabricator.py	Wed Dec 11 23:16:42 2019 -0500
+++ b/hgext/phabricator.py	Fri Nov 22 23:43:59 2019 -0500
@@ -130,6 +130,12 @@
     b'phabricator.desc': b'',
     b'phabricator.drev': b'bold',
     b'phabricator.node': b'',
+    b'phabricator.status.abandoned': b'magenta dim',
+    b'phabricator.status.accepted': b'green bold',
+    b'phabricator.status.closed': b'green',
+    b'phabricator.status.needsreview': b'yellow',
+    b'phabricator.status.needsrevision': b'red',
+    b'phabricator.status.changesplanned': b'red',
 }
 
 _VCR_FLAGS = [
@@ -1728,7 +1734,11 @@
 
     def phabstatus(ctx):
         drev = drevsbyrev[ctx.rev()]
-        ui.write(b"\n%(uri)s %(statusName)s\n" % drev)
+        status = ui.label(
+            b'%(statusName)s' % drev,
+            b'phabricator.status.%s' % _getstatusname(drev),
+        )
+        ui.write(b"\n%s %s\n" % (drev[b'uri'], status))
 
     revs -= smartset.baseset(unknownrevs)
     revdag = graphmod.dagwalker(repo, revs)