Patchwork [2,of,5,relative-diff] keyword: monkeypatch patch.diff more generically

login
register
mail settings
Submitter Siddharth Agarwal
Date March 17, 2015, 10:57 p.m.
Message ID <11254d47861cfbda255b.1426633047@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8129/
State Accepted
Commit 3e8b06097d00b8e22918ba9e6daf9613dd3a8229
Headers show

Comments

Siddharth Agarwal - March 17, 2015, 10:57 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1426631614 25200
#      Tue Mar 17 15:33:34 2015 -0700
# Node ID 11254d47861cfbda255bd76c86c22cc959c79041
# Parent  ea13de719441936557d9e81bca77fe3a8d8a9934
keyword: monkeypatch patch.diff more generically

This function doesn't need access to any of the args or kwargs, so make the
monkeypatching more robust. (In upcoming patches we'll introduce another
argument to patch.diff, and this function would break if it weren't for this
patch.)

Patch

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -643,11 +643,10 @@ 
         # shrink keywords read from working dir
         self.lines = kwt.shrinklines(self.fname, self.lines)
 
-    def kwdiff(orig, repo, node1=None, node2=None, match=None, changes=None,
-                opts=None, prefix=''):
+    def kwdiff(orig, *args, **kwargs):
         '''Monkeypatch patch.diff to avoid expansion.'''
         kwt.restrict = True
-        return orig(repo, node1, node2, match, changes, opts, prefix)
+        return orig(*args, **kwargs)
 
     def kwweb_skip(orig, web, req, tmpl):
         '''Wraps webcommands.x turning off keyword expansion.'''