Show More
@@ -1005,12 +1005,12 b' def applydiff(ui, fp, changed, strip=1, ' | |||||
1005 | return -1 |
|
1005 | return -1 | |
1006 | return err |
|
1006 | return err | |
1007 |
|
1007 | |||
1008 |
def diffopts(ui, opts= |
|
1008 | def diffopts(ui, opts=None, untrusted=False): | |
1009 | def get(key, name=None, getter=ui.configbool): |
|
1009 | def get(key, name=None, getter=ui.configbool): | |
1010 | return (opts.get(key) or |
|
1010 | return ((opts and opts.get(key)) or | |
1011 | getter('diff', name or key, None, untrusted=untrusted)) |
|
1011 | getter('diff', name or key, None, untrusted=untrusted)) | |
1012 | return mdiff.diffopts( |
|
1012 | return mdiff.diffopts( | |
1013 | text=opts.get('text'), |
|
1013 | text=opts and opts.get('text'), | |
1014 | git=get('git'), |
|
1014 | git=get('git'), | |
1015 | nodates=get('nodates'), |
|
1015 | nodates=get('nodates'), | |
1016 | showfunc=get('show_function', 'showfunc'), |
|
1016 | showfunc=get('show_function', 'showfunc'), | |
@@ -1096,10 +1096,12 b' def externalpatch(patcher, args, patchna' | |||||
1096 | util.explain_exit(code)[0]) |
|
1096 | util.explain_exit(code)[0]) | |
1097 | return fuzz |
|
1097 | return fuzz | |
1098 |
|
1098 | |||
1099 |
def internalpatch(patchobj, ui, strip, cwd, files= |
|
1099 | def internalpatch(patchobj, ui, strip, cwd, files=None, eolmode='strict'): | |
1100 | """use builtin patch to apply <patchobj> to the working directory. |
|
1100 | """use builtin patch to apply <patchobj> to the working directory. | |
1101 | returns whether patch was applied with fuzz factor.""" |
|
1101 | returns whether patch was applied with fuzz factor.""" | |
1102 |
|
1102 | |||
|
1103 | if files is None: | |||
|
1104 | files = {} | |||
1103 | if eolmode is None: |
|
1105 | if eolmode is None: | |
1104 | eolmode = ui.config('patch', 'eol', 'strict') |
|
1106 | eolmode = ui.config('patch', 'eol', 'strict') | |
1105 | try: |
|
1107 | try: | |
@@ -1123,7 +1125,7 b' def internalpatch(patchobj, ui, strip, c' | |||||
1123 | raise PatchError |
|
1125 | raise PatchError | |
1124 | return ret > 0 |
|
1126 | return ret > 0 | |
1125 |
|
1127 | |||
1126 |
def patch(patchname, ui, strip=1, cwd=None, files= |
|
1128 | def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'): | |
1127 | """Apply <patchname> to the working directory. |
|
1129 | """Apply <patchname> to the working directory. | |
1128 |
|
1130 | |||
1129 | 'eolmode' specifies how end of lines should be handled. It can be: |
|
1131 | 'eolmode' specifies how end of lines should be handled. It can be: | |
@@ -1137,6 +1139,8 b' def patch(patchname, ui, strip=1, cwd=No' | |||||
1137 | """ |
|
1139 | """ | |
1138 | patcher = ui.config('ui', 'patch') |
|
1140 | patcher = ui.config('ui', 'patch') | |
1139 | args = [] |
|
1141 | args = [] | |
|
1142 | if files is None: | |||
|
1143 | files = {} | |||
1140 | try: |
|
1144 | try: | |
1141 | if patcher: |
|
1145 | if patcher: | |
1142 | return externalpatch(patcher, args, patchname, ui, strip, cwd, |
|
1146 | return externalpatch(patcher, args, patchname, ui, strip, cwd, |
General Comments 0
You need to be logged in to leave comments.
Login now