changeset 5182:df5e6e3884bc

compat: drop 4.5 compatibility for strdiff
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 04 Mar 2020 16:30:38 +0100
parents c979d64a2589
children 9ac6779d608c
files hgext3rd/evolve/compat.py hgext3rd/evolve/obshistory.py
diffstat 2 files changed, 3 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/compat.py	Wed Mar 04 16:30:19 2020 +0100
+++ b/hgext3rd/evolve/compat.py	Wed Mar 04 16:30:38 2020 +0100
@@ -8,12 +8,10 @@
 
 import array
 import contextlib
-import inspect
 
 from mercurial import (
     context,
     copies,
-    mdiff,
     obsolete,
     pycompat,
     registrar,
@@ -93,24 +91,6 @@
                                   copied=copied.get(path))  # pytype: disable=wrong-keyword-args
     return mctx
 
-def strdiff(a, b, fn1, fn2):
-    """ A version of mdiff.unidiff for comparing two strings
-    """
-    args = [a, b'', b, b'', fn1, fn2]
-
-    # hg < 4.6 compat 8b6dd3922f70
-    if util.safehasattr(inspect, 'signature'):
-        signature = inspect.signature(mdiff.unidiff)
-        needsbinary = r'binary' in signature.parameters
-    else:
-        argspec = inspect.getargspec(mdiff.unidiff)
-        needsbinary = r'binary' in argspec.args
-
-    if needsbinary:
-        args.append(False)
-
-    return mdiff.unidiff(*args)
-
 # 46c2b19a1263f18a5829a21b7a5053019b0c5a31 in hg moved repair.stripbmrevset to
 # scmutil.bookmarkrevs
 # This change is a part of 4.7 cycle, so drop this when we drop support for hg <= 4.6
--- a/hgext3rd/evolve/obshistory.py	Wed Mar 04 16:30:19 2020 +0100
+++ b/hgext3rd/evolve/obshistory.py	Wed Mar 04 16:30:38 2020 +0100
@@ -14,6 +14,7 @@
     error,
     graphmod,
     logcmdutil,
+    mdiff,
     node as nodemod,
     obsutil,
     patch,
@@ -248,8 +249,8 @@
     basename = b"changeset-description"
     succname = b"changeset-description"
 
-    d = compat.strdiff(basedesc, succdesc, basename, succname)
-    uheaders, hunks = d
+    uheaders, hunks = mdiff.unidiff(basedesc, b'', succdesc, b'',
+                                    basename, succname, False)
 
     # Copied from patch.diff
     text = b''.join(sum((list(hlines) for hrange, hlines in hunks), []))