mercurial/patch.py
changeset 10731 71cf11f03b3d
parent 10615 3bb438ce4458
parent 10729 7a5931c5f2dc
child 10744 d794ea113834
equal deleted inserted replaced
10727:62b8f15683f2 10731:71cf11f03b3d
   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])', re.MULTILINE)
   181                         r'(---|\*\*\*)[ \t].*?'
       
   182                         r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL)
   182 
   183 
   183     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   184     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
   184     tmpfp = os.fdopen(fd, 'w')
   185     tmpfp = os.fdopen(fd, 'w')
   185     try:
   186     try:
   186         msg = email.Parser.Parser().parse(fileobj)
   187         msg = email.Parser.Parser().parse(fileobj)