heads: fix templating of headers again (issue2130) stable
authorSimon Howkins <simonh@symbian.org>
Thu, 24 Jun 2010 15:18:47 +0100
branchstable
changeset 11465 ace5bd98bee3
parent 11464 521c8e0c93bf
child 11466 ad27428c59ce
heads: fix templating of headers again (issue2130) (tweaks and test by mpm)
mercurial/cmdutil.py
tests/test-command-template
tests/test-command-template.out
--- a/mercurial/cmdutil.py	Wed Jun 30 12:44:58 2010 +0900
+++ b/mercurial/cmdutil.py	Thu Jun 24 15:18:47 2010 +0100
@@ -687,7 +687,6 @@
         self.patch = patch
         self.diffopts = diffopts
         self.header = {}
-        self.doneheader = False
         self.hunk = {}
         self.lastheader = None
         self.footer = None
@@ -906,9 +905,9 @@
                 if self.buffered:
                     self.header[ctx.rev()] = h
                 else:
-                    if not self.doneheader:
+                    if self.lastheader != h:
+                        self.lastheader = h
                         self.ui.write(h)
-                        self.doneheader = True
 
             # write changeset metadata, then patch if requested
             key = types['changeset']
--- a/tests/test-command-template	Wed Jun 30 12:44:58 2010 +0900
+++ b/tests/test-command-template	Thu Jun 24 15:18:47 2010 +0100
@@ -100,6 +100,9 @@
 hg log --style=changelog > changelog
 cat changelog
 
+echo '# issue 2130'
+hg heads --style changelog
+
 echo "# keys work"
 for key in author branches date desc file_adds file_dels file_mods \
         file_copies file_copies_switch files \
--- a/tests/test-command-template.out	Wed Jun 30 12:44:58 2010 +0900
+++ b/tests/test-command-template.out	Thu Jun 24 15:18:47 2010 +0100
@@ -437,6 +437,23 @@
 	line 1 line 2
 	[1e4e1b8f71e0]
 
+# issue 2130
+2020-01-01  test  <test>
+
+	* fourth, second, third:
+	third
+	[95c24699272e] [tip]
+
+1970-01-18  person  <person>
+
+	* merge
+	[c7b487c6c50e]
+
+1970-01-17  person  <person>
+
+	* new branch
+	[32a18f097fcc] <foo>
+
 # keys work
 author: test
 author: User Name <user@hostname>