Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 8843:eb7b247a98ea
kill trailing whitespace
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Fri, 19 Jun 2009 13:47:50 +0200 |
parents | 6c9dce20ed70 |
children | 5fe8dc75aa4a |
comparison
equal
deleted
inserted
replaced
8842:acd03a6e2426 | 8843:eb7b247a98ea |
---|---|
970 raise NoHunks | 970 raise NoHunks |
971 | 971 |
972 def applydiff(ui, fp, changed, strip=1, sourcefile=None, reverse=False, | 972 def applydiff(ui, fp, changed, strip=1, sourcefile=None, reverse=False, |
973 eol=None): | 973 eol=None): |
974 """ | 974 """ |
975 Reads a patch from fp and tries to apply it. | 975 Reads a patch from fp and tries to apply it. |
976 | 976 |
977 The dict 'changed' is filled in with all of the filenames changed | 977 The dict 'changed' is filled in with all of the filenames changed |
978 by the patch. Returns 0 for a clean patch, -1 if any rejects were | 978 by the patch. Returns 0 for a clean patch, -1 if any rejects were |
979 found and 1 if there was any fuzz. | 979 found and 1 if there was any fuzz. |
980 | 980 |
1135 eolmode = ui.config('patch', 'eol', 'strict') | 1135 eolmode = ui.config('patch', 'eol', 'strict') |
1136 try: | 1136 try: |
1137 eol = {'strict': None, 'crlf': '\r\n', 'lf': '\n'}[eolmode.lower()] | 1137 eol = {'strict': None, 'crlf': '\r\n', 'lf': '\n'}[eolmode.lower()] |
1138 except KeyError: | 1138 except KeyError: |
1139 raise util.Abort(_('Unsupported line endings type: %s') % eolmode) | 1139 raise util.Abort(_('Unsupported line endings type: %s') % eolmode) |
1140 | 1140 |
1141 try: | 1141 try: |
1142 fp = file(patchobj, 'rb') | 1142 fp = file(patchobj, 'rb') |
1143 except TypeError: | 1143 except TypeError: |
1144 fp = patchobj | 1144 fp = patchobj |
1145 if cwd: | 1145 if cwd: |