[PATCH 2 of 2] color: add additional changeset.phase label to log.changeset and log.parent

Augie Fackler raf at durin42.com
Wed Oct 17 12:34:58 CDT 2012


queued, thanks

On Oct 17, 2012, at 10:28 AM, Sean Farley <sean.michael.farley at gmail.com> wrote:

> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1350412558 18000
> # Node ID b817a47b279911c7e8975ceb5d3ca4c5eb0e9d1a
> # Parent  072adc076e641990cf0000ece34e9545ebaaa0b3
> 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.
> 
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -685,11 +685,11 @@
> 
>         parents = [(p, hexfunc(log.node(p)))
>                    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
>         if branch != 'default':
>             self.ui.write(_("branch:      %s\n") % branch,
> @@ -703,11 +703,11 @@
>         if self.ui.debugflag and ctx.phase():
>             self.ui.write(_("phase:       %s\n") % _(ctx.phasestr()),
>                           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()
>             self.ui.write(_("manifest:    %d:%s\n") %
>                           (self.repo.manifest.rev(mnode), hex(mnode)),
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -975,11 +975,11 @@
>                 notice = _(' (inactive)')
>             if ctx.branch() == repo.dirstate.branch():
>                 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)
>             else:
>                 ui.write("%s %s%s\n" % (tag, rev, notice))
> @@ -5421,11 +5421,11 @@
> 
>     for p in parents:
>         # 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())
>         if p.rev() == -1:
>             if not len(repo):
> @@ -5708,11 +5708,11 @@
>             ui.write("%s\n" % t, label='tags.normal')
>             continue
> 
>         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')
>         if ui.verbose:
>             if repo.tagtype(t) == 'local':
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list