patch.internalpatch: add a default value for prefix
authorSiddharth Agarwal <sid0@fb.com>
Tue, 10 Mar 2015 17:34:42 -0700
changeset 24268 cf7d252d8c30
parent 24267 365fdbc54f1f
child 24269 9a745ced79a9
patch.internalpatch: add a default value for prefix Rev 60c279ab7bd3 adding a parameter here. This breaks third-party extensions like crecord and also makes the issue fairly hard to fix on the extension's side if it wants to retain compatibility across Mercurial versions -- in old versions, the positional argument will be passed into the next unknown argument, which is 'files'. The patch also undoes a change to the record extension that is no longer necessary.
hgext/record.py
mercurial/patch.py
--- a/hgext/record.py	Wed Mar 11 07:19:55 2015 -0700
+++ b/hgext/record.py	Tue Mar 10 17:34:42 2015 -0700
@@ -365,7 +365,7 @@
                 try:
                     ui.debug('applying patch\n')
                     ui.debug(fp.getvalue())
-                    patch.internalpatch(ui, repo, fp, 1, '', eolmode=None)
+                    patch.internalpatch(ui, repo, fp, 1, eolmode=None)
                 except patch.PatchError, err:
                     raise util.Abort(str(err))
             del fp
--- a/mercurial/patch.py	Wed Mar 11 07:19:55 2015 -0700
+++ b/mercurial/patch.py	Tue Mar 10 17:34:42 2015 -0700
@@ -1757,7 +1757,7 @@
         raise PatchError(_('patch failed to apply'))
     return ret > 0
 
-def internalpatch(ui, repo, patchobj, strip, prefix, files=None,
+def internalpatch(ui, repo, patchobj, strip, prefix='', files=None,
                   eolmode='strict', similarity=0):
     """use builtin patch to apply <patchobj> to the working directory.
     returns whether patch was applied with fuzz factor."""