Patchwork [relative-import] patch.internalpatch: add a default value for prefix

login
register
mail settings
Submitter Siddharth Agarwal
Date March 11, 2015, 12:43 a.m.
Message ID <eb4231fc81ee228ea4c4.1426034615@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7986/
State Accepted
Commit cf7d252d8c30bcf6df02d542f32d22e900def61e
Headers show

Comments

Siddharth Agarwal - March 11, 2015, 12:43 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1426034082 25200
#      Tue Mar 10 17:34:42 2015 -0700
# Node ID eb4231fc81ee228ea4c4b5d689e89b8d023a5b24
# Parent  2dbbd9aa8f78ffdbe9931f59bb6def4d8e2edcc7
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.
Pierre-Yves David - March 11, 2015, 3:29 a.m.
On 03/10/2015 05:43 PM, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1426034082 25200
> #      Tue Mar 10 17:34:42 2015 -0700
> # Node ID eb4231fc81ee228ea4c4b5d689e89b8d023a5b24
> # Parent  2dbbd9aa8f78ffdbe9931f59bb6def4d8e2edcc7
> patch.internalpatch: add a default value for prefix

Pushed to the clowncopter (with no lack of smiling).

Patch

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -604,7 +604,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
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1521,7 +1521,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."""