hgext/mq.py
changeset 5174 5bbbd1f1d586
parent 4911 fc502517d68d
child 5175 f8aa16533ddf
child 5240 438ff951df70
equal deleted inserted replaced
5169:ee702e7f181f 5174:5bbbd1f1d586
   914         # if the patch was a git patch, refresh it as a git patch
   914         # if the patch was a git patch, refresh it as a git patch
   915         for line in patchf:
   915         for line in patchf:
   916             if line.startswith('diff --git'):
   916             if line.startswith('diff --git'):
   917                 self.diffopts().git = True
   917                 self.diffopts().git = True
   918                 break
   918                 break
   919         patchf.seek(0)
       
   920         patchf.truncate()
       
   921 
   919 
   922         msg = opts.get('msg', '').rstrip()
   920         msg = opts.get('msg', '').rstrip()
   923         if msg:
   921         if msg:
   924             if comments:
   922             if comments:
   925                 # Remove existing message.
   923                 # Remove existing message.
   930                         subj = comments[ci][9:]
   928                         subj = comments[ci][9:]
   931                     while message[mi] != comments[ci] and message[mi] != subj:
   929                     while message[mi] != comments[ci] and message[mi] != subj:
   932                         ci += 1
   930                         ci += 1
   933                     del comments[ci]
   931                     del comments[ci]
   934             comments.append(msg)
   932             comments.append(msg)
       
   933 
       
   934         patchf.seek(0)
       
   935         patchf.truncate()
       
   936 
   935         if comments:
   937         if comments:
   936             comments = "\n".join(comments) + '\n\n'
   938             comments = "\n".join(comments) + '\n\n'
   937             patchf.write(comments)
   939             patchf.write(comments)
   938 
   940 
   939         if opts.get('git'):
   941         if opts.get('git'):