diff hgext/mq.py @ 22519:c87f2a5a6e49

mq: correctly make an empty line after description in new patches There would in some cases be an empty line between headers and the description - that does not seem right. There should also be an empty line between description and diff - but that was missing. These two mistakes would sometimes make it up for each other so we fix both at once to just show the improvement. Instead of writing an extra newline when writing a header line, write an extra line when it not is written as a part of the description but is necessary anyway.
author Mads Kiilerich <madski@unity3d.com>
date Sat, 20 Sep 2014 17:06:56 +0200
parents 48791c2bea1c
children 9d4ebb75de53
line wrap: on
line diff
--- a/hgext/mq.py	Tue Sep 16 14:51:56 2014 -0700
+++ b/hgext/mq.py	Sat Sep 20 17:06:56 2014 +0200
@@ -1073,10 +1073,8 @@
                 if self.plainmode:
                     if user:
                         p.write("From: " + user + "\n")
-                        if not date:
-                            p.write("\n")
                     if date:
-                        p.write("Date: %d %d\n\n" % date)
+                        p.write("Date: %d %d\n" % date)
                 else:
                     p.write("# HG changeset patch\n")
                     p.write("# Parent "
@@ -1084,7 +1082,7 @@
                     if user:
                         p.write("# User " + user + "\n")
                     if date:
-                        p.write("# Date %s %s\n\n" % date)
+                        p.write("# Date %s %s\n" % date)
 
                 defaultmsg = "[mq]: %s" % patchfn
                 editor = cmdutil.getcommiteditor(editform=editform)
@@ -1117,6 +1115,8 @@
                     if nctx.description() != defaultmsg.rstrip():
                         msg = nctx.description() + "\n\n"
                         p.write(msg)
+                    elif not self.plainmode or date or user:
+                        p.write('\n')
                     if commitfiles:
                         parent = self.qparents(repo, n)
                         if inclsubs: