Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 13751:85d74f6babf6
patch: deprecate ui.patch / external patcher feature
Why?
- Mercurial internal patcher works correctly for regular patches and git
patches, is much faster at least on Windows and is more extensible.
- In theory, the external patcher can be used to handle exotic patch formats. I
do not know any and have not heard about any such use in years.
- Most patch programs cannot handle git format patches, which makes the API
caller to decide either to ignore ui.patch by calling patch.internalpatch()
directly, or take the risk of random failures with valid inputs.
- One thing a patch program could do Mercurial patcher cannot is applying with
--reverse. Apparently several shelve like extensions try to use that,
including passing the "reverse" option to Mercurial patcher, which has been
removed mid-2009. I never heard anybody complain about that, and would prefer
reimplementing it anyway.
And from the technical perspective:
- The external patcher makes everything harder to maintain and implement. EOL
normalization is not implemented, and I would bet file renames, if supported
by the patcher, are not correctly recorded in the dirstate.
- No tests.
How?
- Remove related documentation
- Clearly mark patch.externalpatch() as private
- Remove the debuginstall check. This deprecation request was actually
triggered by this last point. debuginstall is the only piece of code patching
without a repository. When migrating to an integrated patch() + updatedir()
call, this was really a showstopper, all workarounds were either ugly or
uselessly complicated to implement. If we do not support external patcher
anymore, the debuginstall check is not useful anymore.
- Remove patch.externalpatch() after 1.9 release.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 24 Mar 2011 10:28:29 +0100 |
parents | bc38ff7cb919 |
children | a8d13ee0ce68 |
comparison
equal
deleted
inserted
replaced
13750:7eb82f88e157 | 13751:85d74f6babf6 |
---|---|
1154 | 1154 |
1155 if rejects: | 1155 if rejects: |
1156 return -1 | 1156 return -1 |
1157 return err | 1157 return err |
1158 | 1158 |
1159 def externalpatch(patcher, patchname, ui, strip, cwd, files): | 1159 def _externalpatch(patcher, patchname, ui, strip, cwd, files): |
1160 """use <patcher> to apply <patchname> to the working directory. | 1160 """use <patcher> to apply <patchname> to the working directory. |
1161 returns whether patch was applied with fuzz factor.""" | 1161 returns whether patch was applied with fuzz factor.""" |
1162 | 1162 |
1163 fuzz = False | 1163 fuzz = False |
1164 args = [] | 1164 args = [] |
1238 patcher = ui.config('ui', 'patch') | 1238 patcher = ui.config('ui', 'patch') |
1239 if files is None: | 1239 if files is None: |
1240 files = {} | 1240 files = {} |
1241 try: | 1241 try: |
1242 if patcher: | 1242 if patcher: |
1243 return externalpatch(patcher, patchname, ui, strip, cwd, files) | 1243 return _externalpatch(patcher, patchname, ui, strip, cwd, files) |
1244 return internalpatch(patchname, ui, strip, cwd, files, eolmode) | 1244 return internalpatch(patchname, ui, strip, cwd, files, eolmode) |
1245 except PatchError, err: | 1245 except PatchError, err: |
1246 raise util.Abort(str(err)) | 1246 raise util.Abort(str(err)) |
1247 | 1247 |
1248 def b85diff(to, tn): | 1248 def b85diff(to, tn): |