mercurial/patch.py
changeset 12728 80a3d1121c10
parent 12675 c6cdc123f6e4
child 12825 61f48581d8ef
equal deleted inserted replaced
12727:52971985be14 12728:80a3d1121c10
   226 
   226 
   227                 ui.debug('found patch at byte %d\n' % m.start(0))
   227                 ui.debug('found patch at byte %d\n' % m.start(0))
   228                 diffs_seen += 1
   228                 diffs_seen += 1
   229                 cfp = cStringIO.StringIO()
   229                 cfp = cStringIO.StringIO()
   230                 for line in payload[:m.start(0)].splitlines():
   230                 for line in payload[:m.start(0)].splitlines():
   231                     if line.startswith('# HG changeset patch'):
   231                     if line.startswith('# HG changeset patch') and not hgpatch:
   232                         ui.debug('patch generated by hg export\n')
   232                         ui.debug('patch generated by hg export\n')
       
   233                         hgpatch = True
   233                         hgpatchheader = True
   234                         hgpatchheader = True
   234                         # drop earlier commit message content
   235                         # drop earlier commit message content
   235                         cfp.seek(0)
   236                         cfp.seek(0)
   236                         cfp.truncate()
   237                         cfp.truncate()
   237                         subject = None
   238                         subject = None
   247                             nodeid = line[10:]
   248                             nodeid = line[10:]
   248                         elif line.startswith("# Parent "):
   249                         elif line.startswith("# Parent "):
   249                             parents.append(line[10:])
   250                             parents.append(line[10:])
   250                         elif not line.startswith("# "):
   251                         elif not line.startswith("# "):
   251                             hgpatchheader = False
   252                             hgpatchheader = False
   252                             hgpatch = True
       
   253                     elif line == '---' and gitsendmail:
   253                     elif line == '---' and gitsendmail:
   254                         ignoretext = True
   254                         ignoretext = True
   255                     if not hgpatchheader and not ignoretext:
   255                     if not hgpatchheader and not ignoretext:
   256                         cfp.write(line)
   256                         cfp.write(line)
   257                         cfp.write('\n')
   257                         cfp.write('\n')