changeset 5180:5bbbd1f1d586

mq: truncate patch just before rewriting header
author Brendan Cully <brendan@kublai.com>
date Wed, 15 Aug 2007 16:20:10 -0700
parents ee702e7f181f
children ee6a6592c997 f8aa16533ddf
files hgext/mq.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Aug 15 16:18:40 2007 +0200
+++ b/hgext/mq.py	Wed Aug 15 16:20:10 2007 -0700
@@ -916,8 +916,6 @@
             if line.startswith('diff --git'):
                 self.diffopts().git = True
                 break
-        patchf.seek(0)
-        patchf.truncate()
 
         msg = opts.get('msg', '').rstrip()
         if msg:
@@ -932,6 +930,10 @@
                         ci += 1
                     del comments[ci]
             comments.append(msg)
+
+        patchf.seek(0)
+        patchf.truncate()
+
         if comments:
             comments = "\n".join(comments) + '\n\n'
             patchf.write(comments)