[PATCH 2 of 3] mq: upgrade the patch to HG format when adding the user name with qrefresh

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Sat Aug 8 15:57:41 CDT 2009


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
# Date 1249671333 -7200
# Node ID fcd2d70b963cbc3b1ad2b839669970ee325b0570
# Parent  2ba25ea4240e6c8916e35c4f09ba766b179efcdc
mq: upgrade the patch to HG format when adding the user name with qrefresh

If no username field is present in the patch, and the patch is not yet
in the extended Mercurial format, then upgrade the patch to the extended
Mercurial format and add an appropriate '# User' field, instead of adding
an email-like 'From:' header.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -144,7 +144,10 @@
                 patchheaderat = self.comments.index('# HG changeset patch')
                 self.comments.insert(patchheaderat + 1, '# User ' + user)
             except ValueError:
-                self.comments = ['From: ' + user, ''] + self.comments
+                self.comments = (['# HG changeset patch',
+                                  '# User ' + user,
+                                  '']
+                                 + self.comments)
         self.user = user
 
     def setdate(self, date):




More information about the Mercurial-devel mailing list