mercurial/patch.py
branchstable
changeset 10736 a528a1046dba
parent 10729 7a5931c5f2dc
child 10744 d794ea113834
child 10745 d94832c4a31d
equal deleted inserted replaced
10733:e26102c40e2e 10736:a528a1046dba
   176 
   176 
   177     # attempt to detect the start of a patch
   177     # attempt to detect the start of a patch
   178     # (this heuristic is borrowed from quilt)
   178     # (this heuristic is borrowed from quilt)
   179     diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
   179     diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
   180                         r'retrieving revision [0-9]+(\.[0-9]+)*$|'
   180                         r'retrieving revision [0-9]+(\.[0-9]+)*$|'
   181                         r'(---|\*\*\*)[ \t].*?'
   181                         r'---[ \t].*?^\+\+\+[ \t]|'
   182                         r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL)
   182                         r'\*\*\*[ \t].*?^---[ \t])', re.MULTILINE|re.DOTALL)
   183 
   183 
   184     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   184     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   185     tmpfp = os.fdopen(fd, 'w')
   185     tmpfp = os.fdopen(fd, 'w')
   186     try:
   186     try:
   187         msg = email.Parser.Parser().parse(fileobj)
   187         msg = email.Parser.Parser().parse(fileobj)