changeset 3193:a6d0cd63068c

Make "hg log --style=changelog > changelog" work (issue338) Style files in templates/ now take precedence over current directory. This can be overridden with --style=./changelog if really neeeded. Added test for issue338.
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 29 Sep 2006 21:24:15 +0200
parents f2ed26736dfa
children 182bdd589cbe
files mercurial/commands.py tests/test-command-template tests/test-command-template.out
diffstat 3 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 29 19:43:07 2006 +0200
+++ b/mercurial/commands.py	Fri Sep 29 21:24:15 2006 +0200
@@ -399,9 +399,9 @@
 
     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 19:43:07 2006 +0200
+++ b/tests/test-command-template	Fri Sep 29 21:24:15 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 19:43:07 2006 +0200
+++ b/tests/test-command-template.out	Fri Sep 29 21:24:15 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