def show_changeset(ui, repo, opts, buffered=False, matchfn=False): """show one changeset using template or regular display. Display format will be the first non-empty hit of: 1. option 'template' 2. option 'style' 3. [ui] setting 'logtemplate' 4. [ui] setting 'style' If all of these values are either the unset or the empty string, regular display via changeset_printer() is done. """ # options patch = False if opts.get('patch'): patch = matchfn or matchall(repo) tmpl = opts.get('template') style = None if tmpl: tmpl = templater.parsestring(tmpl, quoted=False) else: style = opts.get('style') # ui settings if not (tmpl or style): tmpl = ui.config('ui', 'logtemplate') if tmpl: tmpl = templater.parsestring(tmpl) else: style = util.expandpath(ui.config('ui', 'style', '')) if not (tmpl or style): return changeset_printer(ui, repo, patch, opts, buffered) mapfile = None if style and not tmpl: mapfile = style if not os.path.split(mapfile)[0]: mapname = (templater.templatepath('map-cmdline.' + mapfile) or templater.templatepath(mapfile)) if mapname: mapfile = mapname try: t = changeset_templater(ui, repo, patch, opts, mapfile, buffered) except SyntaxError, inst: raise util.Abort(inst.args[0])
def show_changeset(ui, repo, opts, buffered=False): """show one changeset using template or regular display. Display format will be the first non-empty hit of: 1. option 'template' 2. option 'style' 3. [ui] setting 'logtemplate' 4. [ui] setting 'style' If all of these values are either the unset or the empty string, regular display via changeset_printer() is done. """ # options patch = False if opts.get('patch') or opts.get('stat'): patch = matchall(repo) tmpl = opts.get('template') style = None if tmpl: tmpl = templater.parsestring(tmpl, quoted=False) else: style = opts.get('style') # ui settings if not (tmpl or style): tmpl = ui.config('ui', 'logtemplate') if tmpl: tmpl = templater.parsestring(tmpl) else: style = util.expandpath(ui.config('ui', 'style', '')) if not (tmpl or style): return changeset_printer(ui, repo, patch, opts, buffered) mapfile = None if style and not tmpl: mapfile = style if not os.path.split(mapfile)[0]: mapname = (templater.templatepath('map-cmdline.' + mapfile) or templater.templatepath(mapfile)) if mapname: mapfile = mapname try: t = changeset_templater(ui, repo, patch, opts, mapfile, buffered) except SyntaxError, inst: raise util.Abort(inst.args[0])
def _formatlabels(repo, fcd, fco, labels): """Formats the given labels using the conflict marker template. Returns a list of formatted labels. """ cd = fcd.changectx() co = fco.changectx() ui = repo.ui template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker) template = templater.parsestring(template, quoted=False) tmpl = templater.templater(None, cache={ 'conflictmarker' : template }) pad = max(len(labels[0]), len(labels[1])) return [_formatconflictmarker(repo, cd, tmpl, labels[0], pad), _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
def _formatlabels(repo, fcd, fco, labels): """Formats the given labels using the conflict marker template. Returns a list of formatted labels. """ cd = fcd.changectx() co = fco.changectx() ui = repo.ui template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker) template = templater.parsestring(template, quoted=False) tmpl = templater.templater(None, cache={'conflictmarker': template}) pad = max(len(labels[0]), len(labels[1])) return [ _formatconflictmarker(repo, cd, tmpl, labels[0], pad), _formatconflictmarker(repo, co, tmpl, labels[1], pad) ]