diff mercurial/commands.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 cede00420e1e
children 0f9282dc87f8
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Mar 23 19:28:16 2011 -0500
+++ b/mercurial/commands.py	Thu Mar 24 10:28:29 2011 +0100
@@ -1559,45 +1559,6 @@
         ui.write(_(" (templates seem to have been installed incorrectly)\n"))
         problems += 1
 
-    # patch
-    ui.status(_("Checking patch...\n"))
-    patchproblems = 0
-    a = "1\n2\n3\n4\n"
-    b = "1\n2\n3\ninsert\n4\n"
-    fa = writetemp(a)
-    d = mdiff.unidiff(a, None, b, None, os.path.basename(fa),
-        os.path.basename(fa))
-    fd = writetemp(d)
-
-    files = {}
-    try:
-        patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
-    except util.Abort, e:
-        ui.write(_(" patch call failed:\n"))
-        ui.write(" " + str(e) + "\n")
-        patchproblems += 1
-    else:
-        if list(files) != [os.path.basename(fa)]:
-            ui.write(_(" unexpected patch output!\n"))
-            patchproblems += 1
-        a = open(fa).read()
-        if a != b:
-            ui.write(_(" patch test failed!\n"))
-            patchproblems += 1
-
-    if patchproblems:
-        if ui.config('ui', 'patch'):
-            ui.write(_(" (Current patch tool may be incompatible with patch,"
-                       " or misconfigured. Please check your configuration"
-                       " file)\n"))
-        else:
-            ui.write(_(" Internal patcher failure, please report this error"
-                       " to http://mercurial.selenic.com/wiki/BugTracker\n"))
-    problems += patchproblems
-
-    os.unlink(fa)
-    os.unlink(fd)
-
     # editor
     ui.status(_("Checking commit editor...\n"))
     editor = ui.geteditor()