Bug 2130 - wrong patch applied!

Matt Mackall mpm at selenic.com
Wed Jun 30 09:09:27 CDT 2010


On Wed, 2010-06-30 at 08:54 -0500, Matt Mackall wrote:
> On Wed, 2010-06-30 at 11:52 +0100, Simon Howkins wrote:
> > Hi
> > 
> > I can see from the discussion in
> > http://mercurial.selenic.com/bts/issue2130 that a patch has been
> > applied to the crew repository.
> > 
> > However, IT'S THE WRONG PATCH!
> 
> This mail would have been much better if it actually -included the
> correct patch- so I could drag and drop it into the queue, rather than
> try to guess (which I've obviously failed at once already). 
> 
> Is it this one?
> 
> http://mercurial.selenic.com/bts/file1102/2130.txt

Ok, here's the fix I'm applying, note the reuse of existing lastheader
variable. The ugly underbar in lastheader_unbuf caught my eye, and I
quickly determined a new variable isn't needed.

# HG changeset patch
# User Simon Howkins <simonh at symbian.org>
# Date 1277389127 -3600
# Branch stable
# Node ID 878a8ccbac10a64c6a31af9a9cc4d232b36f4602
# Parent  f0ea9355713393141e8f452b7c14062978fa212c
heads: fix templating of headers again (issue2130)

(tweaks and test by mpm)

diff -r f0ea93557133 -r 878a8ccbac10 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Tue Jun 29 17:30:42 2010 -0500
+++ 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']
diff -r f0ea93557133 -r 878a8ccbac10 tests/test-command-template
--- a/tests/test-command-template	Tue Jun 29 17:30:42 2010 -0500
+++ 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 \
diff -r f0ea93557133 -r 878a8ccbac10 tests/test-command-template.out
--- a/tests/test-command-template.out	Tue Jun 29 17:30:42 2010 -0500
+++ 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 at hostname>

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list