hgext/mq.py
changeset 5175 f8aa16533ddf
parent 5140 f6c520fd70cf
parent 5174 5bbbd1f1d586
child 5210 90d9ec0dc69d
equal deleted inserted replaced
5173:7e05bdeee7de 5175:f8aa16533ddf
   922             # if the patch was a git patch, refresh it as a git patch
   922             # if the patch was a git patch, refresh it as a git patch
   923             for line in patchf:
   923             for line in patchf:
   924                 if line.startswith('diff --git'):
   924                 if line.startswith('diff --git'):
   925                     self.diffopts().git = True
   925                     self.diffopts().git = True
   926                     break
   926                     break
   927             patchf.seek(0)
       
   928             patchf.truncate()
       
   929 
   927 
   930             msg = opts.get('msg', '').rstrip()
   928             msg = opts.get('msg', '').rstrip()
   931             if msg:
   929             if msg:
   932                 if comments:
   930                 if comments:
   933                     # Remove existing message.
   931                     # Remove existing message.
   938                             subj = comments[ci][9:]
   936                             subj = comments[ci][9:]
   939                         while message[mi] != comments[ci] and message[mi] != subj:
   937                         while message[mi] != comments[ci] and message[mi] != subj:
   940                             ci += 1
   938                             ci += 1
   941                         del comments[ci]
   939                         del comments[ci]
   942                 comments.append(msg)
   940                 comments.append(msg)
       
   941 
       
   942             patchf.seek(0)
       
   943             patchf.truncate()
       
   944 
   943             if comments:
   945             if comments:
   944                 comments = "\n".join(comments) + '\n\n'
   946                 comments = "\n".join(comments) + '\n\n'
   945                 patchf.write(comments)
   947                 patchf.write(comments)
   946 
   948 
   947             if opts.get('git'):
   949             if opts.get('git'):