diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -687,7 +687,6 @@ class changeset_printer(object): self.patch = patch self.diffopts = diffopts self.header = {} - self.doneheader = False self.hunk = {} self.lastheader = None self.footer = None @@ -906,9 +905,9 @@ class changeset_templater(changeset_prin 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'] diff --git a/tests/test-command-template b/tests/test-command-template --- a/tests/test-command-template +++ b/tests/test-command-template @@ -100,6 +100,9 @@ echo '# issue338' 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 \ diff --git a/tests/test-command-template.out b/tests/test-command-template.out --- a/tests/test-command-template.out +++ b/tests/test-command-template.out @@ -437,6 +437,23 @@ 1970-01-12 User Name line 1 line 2 [1e4e1b8f71e0] +# issue 2130 +2020-01-01 test + + * fourth, second, third: + third + [95c24699272e] [tip] + +1970-01-18 person + + * merge + [c7b487c6c50e] + +1970-01-17 person + + * new branch + [32a18f097fcc] + # keys work author: test author: User Name