color: add additional changeset.phase label to log.changeset and log.parent
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 16 Oct 2012 13:35:58 -0500
changeset 17788 9912baaae7df
parent 17787 21503aa02d4f
child 17789 4cfd02c2df9a
color: add additional changeset.phase label to log.changeset and log.parent This allows the user to set different colors for each phase, e.g. [color] changeset.public = blue changeset.draft = green changeset.secret = red In addition, this doesn't affect current configuration for custom log.changeset colors, but rather adds the option for users that want to visually see which changesets are amendable.
mercurial/cmdutil.py
mercurial/commands.py
--- a/mercurial/cmdutil.py	Tue Oct 16 18:05:33 2012 -0500
+++ b/mercurial/cmdutil.py	Tue Oct 16 13:35:58 2012 -0500
@@ -687,7 +687,7 @@
                    for p in self._meaningful_parentrevs(log, rev)]
 
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)),
-                      label='log.changeset')
+                      label='log.changeset changeset.%s' % ctx.phasestr())
 
         branch = ctx.branch()
         # don't show the default branch name
@@ -705,7 +705,7 @@
                           label='log.phase')
         for parent in parents:
             self.ui.write(_("parent:      %d:%s\n") % parent,
-                          label='log.parent')
+                          label='log.parent changeset.%s' % ctx.phasestr())
 
         if self.ui.debugflag:
             mnode = ctx.manifestnode()
--- a/mercurial/commands.py	Tue Oct 16 18:05:33 2012 -0500
+++ b/mercurial/commands.py	Tue Oct 16 13:35:58 2012 -0500
@@ -977,7 +977,7 @@
                 label = 'branches.current'
             rev = str(ctx.rev()).rjust(31 - encoding.colwidth(ctx.branch()))
             rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())),
-                           'log.changeset')
+                           'log.changeset changeset.%s' % ctx.phasestr())
             tag = ui.label(ctx.branch(), label)
             if ui.quiet:
                 ui.write("%s\n" % tag)
@@ -5423,7 +5423,7 @@
         # label with log.changeset (instead of log.parent) since this
         # shows a working directory parent *changeset*:
         ui.write(_('parent: %d:%s ') % (p.rev(), str(p)),
-                 label='log.changeset')
+                 label='log.changeset changeset.%s' % p.phasestr())
         ui.write(' '.join(p.tags()), label='log.tag')
         if p.bookmarks():
             marks.extend(p.bookmarks())
@@ -5710,7 +5710,7 @@
 
         hn = hexfunc(n)
         r = "%5d:%s" % (repo.changelog.rev(n), hn)
-        rev = ui.label(r, 'log.changeset')
+        rev = ui.label(r, 'log.changeset changeset.%s' % repo[n].phasestr())
         spaces = " " * (30 - encoding.colwidth(t))
 
         tag = ui.label(t, 'tags.normal')