Patchwork D515: phabricator: standardize colors

login
register
mail settings
Submitter phabricator
Date Aug. 25, 2017, 4:33 a.m.
Message ID <1b6793641a810b7484c08fa9140e5472@localhost.localdomain>
Download mbox | patch
Permalink /patch/23323/
State Not Applicable
Headers show

Comments

phabricator - Aug. 25, 2017, 4:33 a.m.
quark updated this revision to Diff 1280.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D515?vs=1272&id=1280

REVISION DETAIL
  https://phab.mercurial-scm.org/D515

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: quark, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -59,6 +59,15 @@ 
 cmdtable = {}
 command = registrar.command(cmdtable)
 
+colortable = {
+    'phabricator.action.created': 'green',
+    'phabricator.action.skipped': 'magenta',
+    'phabricator.action.updated': 'magenta',
+    'phabricator.desc': '',
+    'phabricator.drev': 'bold',
+    'phabricator.node': '',
+}
+
 def urlencodenested(params):
     """like urlencode, but works with nested parameters.
 
@@ -413,9 +422,9 @@ 
             diffmap[ctx.node()] = diff
             newrevid = int(revision[r'object'][r'id'])
             if revid:
-                action = _('updated')
+                action = 'updated'
             else:
-                action = _('created')
+                action = 'created'
 
             # Create a local tag to note the association, if commit message
             # does not have it already
@@ -428,10 +437,14 @@ 
             # Nothing changed. But still set "newrevid" so the next revision
             # could depend on this one.
             newrevid = revid
-            action = _('skipped')
+            action = 'skipped'
 
-        ui.write(_('D%s: %s - %s: %s\n') % (newrevid, action, ctx,
-                                            ctx.description().split('\n')[0]))
+        drevdesc = ui.label('D%s' % newrevid, 'phabricator.drev')
+        actiondesc = ui.label(_(action), 'phabricator.action.%s' % action)
+        nodedesc = ui.label(bytes(ctx), 'phabricator.node')
+        desc = ui.label(ctx.description().split('\n')[0], 'phabricator.desc')
+        ui.write(_('%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc,
+                                            desc))
         drevids.append(newrevid)
         lastrevid = newrevid