Mercurial > hg
comparison mercurial/patch.py @ 10729:7a5931c5f2dc stable
patch: enhance diff detection regexp, allow '--- ' in patch message
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 18 Mar 2010 18:22:34 +0100 |
parents | 3212afb33116 |
children | 71cf11f03b3d a528a1046dba |
comparison
equal
deleted
inserted
replaced
10728:4a70178f9bde | 10729:7a5931c5f2dc |
---|---|
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) |