hgext/mq.py
changeset 4396 15289406f89c
parent 4339 077aafddd35f
child 4409 28b7d949ef6a
equal deleted inserted replaced
4395:47ef2d228375 4396:15289406f89c
   983         msg = opts.get('msg', '').rstrip()
   983         msg = opts.get('msg', '').rstrip()
   984         if msg:
   984         if msg:
   985             if comments:
   985             if comments:
   986                 # Remove existing message.
   986                 # Remove existing message.
   987                 ci = 0
   987                 ci = 0
       
   988                 subj = None
   988                 for mi in xrange(len(message)):
   989                 for mi in xrange(len(message)):
   989                     while message[mi] != comments[ci]:
   990                     if comments[ci].lower().startswith('subject: '):
       
   991                         subj = comments[ci][9:]
       
   992                     while message[mi] != comments[ci] and message[mi] != subj:
   990                         ci += 1
   993                         ci += 1
   991                     del comments[ci]
   994                     del comments[ci]
   992             comments.append(msg)
   995             comments.append(msg)
   993         if comments:
   996         if comments:
   994             comments = "\n".join(comments) + '\n\n'
   997             comments = "\n".join(comments) + '\n\n'