diff mercurial/patch.py @ 37574:a1bcc7ff0eac

diffhelpers: make return value of testhunk() more Pythonic It's no longer C.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 09 Apr 2018 21:08:52 +0900
parents 49b82cdb5983
children 5537d8f5e989
line wrap: on
line diff
--- a/mercurial/patch.py	Mon Apr 09 21:06:46 2018 +0900
+++ b/mercurial/patch.py	Mon Apr 09 21:08:52 2018 +0900
@@ -795,8 +795,7 @@
         # if there's skew we want to emit the "(offset %d lines)" even
         # when the hunk cleanly applies at start + skew, so skip the
         # fast case code
-        if (self.skew == 0 and
-            diffhelpers.testhunk(old, self.lines, oldstart) == 0):
+        if self.skew == 0 and diffhelpers.testhunk(old, self.lines, oldstart):
             if self.remove:
                 self.backend.unlink(self.fname)
             else:
@@ -823,7 +822,7 @@
                     cand = [oldstart]
 
                 for l in cand:
-                    if not old or diffhelpers.testhunk(old, self.lines, l) == 0:
+                    if not old or diffhelpers.testhunk(old, self.lines, l):
                         self.lines[l : l + len(old)] = new
                         self.offset += len(new) - len(old)
                         self.skew = l - orig_start