Mercurial > hg
changeset 3194:182bdd589cbe
merge with crew
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 29 Sep 2006 21:24:45 +0200 |
parents | a6d0cd63068c (diff) 545b6d718593 (current diff) |
children | 705e30c0a230 |
files | mercurial/commands.py |
diffstat | 3 files changed, 55 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Sep 29 20:00:24 2006 +0200 +++ b/mercurial/commands.py Fri Sep 29 21:24:45 2006 +0200 @@ -372,21 +372,36 @@ self.ui.status("\n") def show_changeset(ui, repo, opts): - '''show one changeset. uses template or regular display. caller - can pass in 'style' and 'template' options in opts.''' - + """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 tmpl = opts.get('template') + mapfile = None if tmpl: tmpl = templater.parsestring(tmpl, quoted=False) else: - tmpl = ui.config('ui', 'logtemplate') - if tmpl: tmpl = templater.parsestring(tmpl) - mapfile = opts.get('style') or ui.config('ui', 'style') + mapfile = opts.get('style') + # ui settings + if not mapfile: + tmpl = ui.config('ui', 'logtemplate') + if tmpl: + tmpl = templater.parsestring(tmpl) + else: + mapfile = ui.config('ui', 'style') + if tmpl or mapfile: if mapfile: - if not os.path.isfile(mapfile): - mapname = templater.templatepath('map-cmdline.' + mapfile) - if not mapname: mapname = templater.templatepath(mapfile) + if not os.path.split(mapfile)[0]: + mapname = (templater.templatepath('map-cmdline.' + mapfile) + or templater.templatepath(mapfile)) if mapname: mapfile = mapname try: t = templater.changeset_templater(ui, repo, mapfile)
--- a/tests/test-command-template Fri Sep 29 20:00:24 2006 +0200 +++ b/tests/test-command-template Fri Sep 29 21:24:45 2006 +0200 @@ -65,6 +65,10 @@ echo 'style = t' >> .hg/hgrc hg log +echo '# issue338' +hg log --style=changelog > changelog +cat changelog + echo "# keys work" for key in author branches date desc file_adds file_dels files \ manifest node parents rev tags; do
--- a/tests/test-command-template.out Fri Sep 29 20:00:24 2006 +0200 +++ b/tests/test-command-template.out Fri Sep 29 21:24:45 2006 +0200 @@ -76,6 +76,33 @@ 2 1 0 +# issue338 +1970-01-16 person <person> + + * c: + no user, no domain + [10e46f2dcbf4] [tip] + +1970-01-14 other <other@place> + + * c: + no person + [97054abb4ab8] + +1970-01-13 A. N. Other <other@place> + + * b: + other 1 other 2 + + other 3 + [b608e9d1a3f0] + +1970-01-12 User Name <user@hostname> + + * a: + line 1 line 2 + [1e4e1b8f71e0] + # keys work author: person author: other@place