hgext/mq.py
changeset 4930 fc502517d68d
parent 4737 2ececafa5859
child 4934 8535c1770dd3
child 5148 06154aff2b1a
child 5180 5bbbd1f1d586
--- a/hgext/mq.py	Wed Jul 11 00:53:44 2007 -0700
+++ b/hgext/mq.py	Mon Jul 16 16:50:47 2007 -0700
@@ -909,7 +909,16 @@
         patchparent = self.qparents(repo, top)
         message, comments, user, date, patchfound = self.readheaders(patchfn)
 
-        patchf = self.opener(patchfn, "w")
+        patchf = self.opener(patchfn, 'r+')
+
+        # if the patch was a git patch, refresh it as a git patch
+        for line in patchf:
+            if line.startswith('diff --git'):
+                self.diffopts().git = True
+                break
+        patchf.seek(0)
+        patchf.truncate()
+
         msg = opts.get('msg', '').rstrip()
         if msg:
             if comments: