Clarify precedence for template/style in commands.show_changeset():
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 29 Sep 2006 19:43:07 +0200
changeset 3192 f2ed26736dfa
parent 3189 a73a785ea8e1
child 3193 a6d0cd63068c
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.
mercurial/commands.py
--- 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):