changeset 3192:f2ed26736dfa

Clarify precedence for template/style in commands.show_changeset(): 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.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 29 Sep 2006 19:43:07 +0200
parents a73a785ea8e1
children a6d0cd63068c
files mercurial/commands.py
diffstat 1 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 29 18:39:49 2006 +0200
+++ b/mercurial/commands.py	Fri Sep 29 19:43:07 2006 +0200
@@ -372,16 +372,31 @@
         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):