# HG changeset patch # User Sean Farley # Date 2015-01-15 04:11:02 # Node ID e573dd08aeaf4cbc2ea00c9046246f14eeaeed2f # Parent fef1146b84421d9f26525ae51ae5efce593e0327 namespaces: add colorname member to namespace object Previously, there was no way to change the color label used for 'hg log' output. This patch just adds the member to the object, a future patch will change 'hg log' to use this. diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py --- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -120,14 +120,16 @@ class namespace(object): """ - def __init__(self, name, templatename=None, logname=None, listnames=None, - namemap=None, nodemap=None): + def __init__(self, name, templatename=None, logname=None, colorname=None, + listnames=None, namemap=None, nodemap=None): """create a namespace name: the namespace to be registered (in plural form) templatename: the name to use for templating logname: the name to use for log output; if not specified templatename is used + colorname: the name to use for colored log output; if not specified + logname is used listnames: function to list all names namemap: function that inputs a node, output name(s) nodemap: function that inputs a name, output node(s) @@ -136,6 +138,7 @@ class namespace(object): self.name = name self.templatename = templatename self.logname = logname + self.colorname = colorname self.listnames = listnames self.namemap = namemap self.nodemap = nodemap @@ -144,6 +147,10 @@ class namespace(object): if self.logname is None: self.logname = self.templatename + # if colorname is not specified, just use the logname as a backup + if self.colorname is None: + self.colorname = self.logname + def names(self, repo, node): """method that returns a (sorted) list of names in a namespace that match a given node"""