def _formatflags(ui, repo, rev, flags): """build flag string optionally by template""" tmpl = ui.config('patchbomb', 'flagtemplate') if not tmpl: return ' '.join(flags) out = util.stringio() opts = {'template': templater.unquotestring(tmpl)} with formatter.templateformatter(ui, out, 'patchbombflag', opts) as fm: fm.startitem() fm.context(ctx=repo[rev]) fm.write('flags', '%s', fm.formatlist(flags, name='flag')) return out.getvalue()
def _formatflags(ui, repo, rev, flags): """build flag string optionally by template""" tmpl = ui.config(b'patchbomb', b'flagtemplate') if not tmpl: return b' '.join(flags) out = util.stringio() spec = formatter.literal_templatespec(templater.unquotestring(tmpl)) with formatter.templateformatter(ui, out, b'patchbombflag', {}, spec) as fm: fm.startitem() fm.context(ctx=repo[rev]) fm.write(b'flags', b'%s', fm.formatlist(flags, name=b'flag')) return out.getvalue()