mq: truncate patch just before rewriting header
authorBrendan Cully <brendan@kublai.com>
Wed, 15 Aug 2007 16:20:10 -0700
changeset 5174 5bbbd1f1d586
parent 5169 ee702e7f181f
child 5175 f8aa16533ddf
child 5177 ee6a6592c997
mq: truncate patch just before rewriting header
hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -916,8 +916,6 @@ class queue:
             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 @@ class queue:
                         ci += 1
                     del comments[ci]
             comments.append(msg)
+
+        patchf.seek(0)
+        patchf.truncate()
+
         if comments:
             comments = "\n".join(comments) + '\n\n'
             patchf.write(comments)