Patchwork [8,of,8] mq: write headers of new patches using patchheader

login
register
mail settings
Submitter Mads Kiilerich
Date Sept. 24, 2014, 1 a.m.
Message ID <ea62fe6a743945e745b1.1411520409@localhost.localdomain>
Download mbox | patch
Permalink /patch/5951/
State Accepted
Headers show

Comments

Mads Kiilerich - Sept. 24, 2014, 1 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1411225617 -7200
#      Sat Sep 20 17:06:57 2014 +0200
# Node ID ea62fe6a743945e745b161c3c79dae9a267bd716
# Parent  154f22c36d16a6244c11cf3c99451b6a2e2fa8fe
mq: write headers of new patches using patchheader
Pierre-Yves David - Sept. 26, 2014, 1:24 a.m.
On 09/23/2014 06:00 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1411225617 -7200
> #      Sat Sep 20 17:06:57 2014 +0200
> # Node ID ea62fe6a743945e745b161c3c79dae9a267bd716
> # Parent  154f22c36d16a6244c11cf3c99451b6a2e2fa8fe
> mq: write headers of new patches using patchheader

Growling were loud enough, the rest of them is pushed to the clowncopter.

I'll reply to the other argument when my argument bar will be a bit 
refueled ;-)
Sean Farley - Sept. 26, 2014, 2:34 a.m.
Pierre-Yves David writes:

> On 09/23/2014 06:00 PM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1411225617 -7200
>> #      Sat Sep 20 17:06:57 2014 +0200
>> # Node ID ea62fe6a743945e745b161c3c79dae9a267bd716
>> # Parent  154f22c36d16a6244c11cf3c99451b6a2e2fa8fe
>> mq: write headers of new patches using patchheader
>
> Growling were loud enough, the rest of them is pushed to the clowncopter.
>
> I'll reply to the other argument when my argument bar will be a bit 
> refueled ;-)

/me hands marmoute an ether
Mads Kiilerich - Sept. 26, 2014, 5:03 p.m.
On 09/26/2014 03:24 AM, Pierre-Yves David wrote:
> On 09/23/2014 06:00 PM, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1411225617 -7200
>> #      Sat Sep 20 17:06:57 2014 +0200
>> # Node ID ea62fe6a743945e745b161c3c79dae9a267bd716
>> # Parent  154f22c36d16a6244c11cf3c99451b6a2e2fa8fe
>> mq: write headers of new patches using patchheader
>
> Growling were loud enough, the rest of them is pushed to the clowncopter.
>
> I'll reply to the other argument when my argument bar will be a bit 
> refueled ;-)
>

Thanks. It was a pleasure arguing with you ;-)

/Mads

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1112,20 +1112,6 @@  class queue(object):
                 raise util.Abort(_('cannot write patch "%s": %s')
                                  % (patchfn, e.strerror))
             try:
-                if self.plainmode:
-                    if user:
-                        p.write("From: " + user + "\n")
-                    if date:
-                        p.write("Date: %d %d\n" % date)
-                else:
-                    p.write("# HG changeset patch\n")
-                    if user:
-                        p.write("# User " + user + "\n")
-                    if date:
-                        p.write("# Date %s %s\n" % date)
-                    p.write("# Parent  "
-                            + hex(repo[None].p1().node()) + "\n")
-
                 defaultmsg = "[mq]: %s" % patchfn
                 editor = cmdutil.getcommiteditor(editform=editform)
                 if edit:
@@ -1154,11 +1140,17 @@  class queue(object):
                     self.seriesdirty = True
                     self.applieddirty = True
                     nctx = repo[n]
-                    if nctx.description() != defaultmsg.rstrip():
-                        msg = nctx.description() + "\n\n"
-                        p.write(msg)
-                    elif not self.plainmode or date or user:
-                        p.write('\n')
+                    ph = patchheader(self.join(patchfn), self.plainmode)
+                    if user:
+                        ph.setuser(user)
+                    if date:
+                        ph.setdate('%s %s' % date)
+                    ph.setparent(hex(nctx.p1().node()))
+                    msg = nctx.description().strip()
+                    if msg == defaultmsg.strip():
+                        msg = ''
+                    ph.setmessage(msg)
+                    p.write(str(ph))
                     if commitfiles:
                         parent = self.qparents(repo, n)
                         if inclsubs: