[PATCH 3 of 6] branches: port to generic templater

Yuya Nishihara yuya at tcha.org
Thu Oct 2 11:00:18 CDT 2014


On Thu, 02 Oct 2014 17:27:19 +0200, Mads Kiilerich wrote:
> On 10/02/2014 04:59 PM, Yuya Nishihara wrote:
> > @@ -1093,7 +1094,11 @@ def branches(ui, repo, active=False, clo
> >       Returns 0.
> >       """
> >   
> > -    hexfunc = ui.debugflag and hex or short
> > +    fm = ui.formatter('branches', opts)
> > +    if fm or ui.debugflag:
> > +        hexfunc = hex
> > +    else:
> > +        hexfunc = short
> 
> I don't remember if I mentioned it before, but I think we reuse this 
> pattern so often that we should introduce something like 
> ui.hexfunc(alwaysfull=fm).

Yeah, I have another one in "bookmarks -T" patch.

Since formatter knows ui, maybe we can do fm.hexfunc() -> hexfunc or
fm.hex -> hexfunc ?

Regards,


More information about the Mercurial-devel mailing list