mercurial/commands.py
changeset 674 6513ba7d858a
parent 668 d93f0b127b6a
child 675 49de76abc4da
equal deleted inserted replaced
673:8e518e11f6cf 674:6513ba7d858a
   604         ui.debug('text:\n')
   604         ui.debug('text:\n')
   605         for t in text.splitlines():
   605         for t in text.splitlines():
   606             ui.debug(t,'\n')
   606             ui.debug(t,'\n')
   607             if t == '# HG changeset patch' or hgpatch == True:
   607             if t == '# HG changeset patch' or hgpatch == True:
   608                 hgpatch = True
   608                 hgpatch = True
   609                 if t[:7] == "# User ":
   609                 if t.startswith("# User "):
   610                     user = t[7:]
   610                     user = t[7:]
   611                     ui.debug('User: %s\n' % user)
   611                     ui.debug('User: %s\n' % user)
   612                 if t[:2] <> "# " and t.strip() and not snippet: snippet = t
   612                 if not t.startswith("# ") and t.strip() and not snippet: snippet = t
   613         if snippet: text = snippet + '\n' + text
   613         if snippet: text = snippet + '\n' + text
   614         ui.debug('text:\n%s\n' % text)
   614         ui.debug('text:\n%s\n' % text)
   615 
   615 
   616         # make sure text isn't empty
   616         # make sure text isn't empty
   617         if not text: text = "imported patch %s\n" % patch
   617         if not text: text = "imported patch %s\n" % patch
   619         f = os.popen("patch -p%d < %s" % (strip, pf))
   619         f = os.popen("patch -p%d < %s" % (strip, pf))
   620         files = []
   620         files = []
   621         for l in f.read().splitlines():
   621         for l in f.read().splitlines():
   622             l.rstrip('\r\n');
   622             l.rstrip('\r\n');
   623             ui.status("%s\n" % l)
   623             ui.status("%s\n" % l)
   624             if l[:14] == 'patching file ':
   624             if l.startswith('patching file '):
   625                 pf = l[14:]
   625                 pf = l[14:]
   626                 if pf not in files:
   626                 if pf not in files:
   627                     files.append(pf)
   627                     files.append(pf)
   628         patcherr = f.close()
   628         patcherr = f.close()
   629         if patcherr:
   629         if patcherr: