[PATCH] Change patch header as well as commit message with qrefresh -m or -l

Brendan Cully brendan at kublai.com
Tue Aug 1 01:49:59 UTC 2006


On Monday, 31 July 2006 at 17:52, Brendan Cully wrote:
> # HG changeset patch
> # User Brendan Cully <brendan at kublai.com>
> # Date 1154393490 25200
> # Node ID fd1b6098d99e99193ae5693c6642230c81a47a38
> # Parent  ae5ce3454ef50d3d512e7cc208a6cc0d148a226c
> Change patch header as well as commit message with qrefresh -m or -l.

There was a buglet here when the existing header was empty.
-------------- next part --------------
# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Date 1154396863 25200
# Node ID de7bf679c23cf1f7b21787b514574be82fad8d80
# Parent  ae5ce3454ef50d3d512e7cc208a6cc0d148a226c
Change patch header as well as commit message with qrefresh -m or -l.

diff -r ae5ce3454ef5 -r de7bf679c23c hgext/mq.py
--- a/hgext/mq.py	Mon Jul 31 07:31:31 2006 -0700
+++ b/hgext/mq.py	Mon Jul 31 18:47:43 2006 -0700
@@ -811,6 +811,16 @@ class queue:
         message, comments, user, date, patchfound = self.readheaders(patch)
 
         patchf = self.opener(patch, "w")
+        msg = msg.rstrip()
+        if msg:
+            if comments:
+                # Remove existing message.
+                ci = 0
+                for mi in range(len(message)):
+                    while message[mi] != comments[ci]:
+                        ci += 1
+                    del comments[ci]
+            comments.append(msg)
         if comments:
             comments = "\n".join(comments) + '\n\n'
             patchf.write(comments)


More information about the Mercurial mailing list