##// END OF EJS Templates
patch: add fuzz config flag (issue4697)
Matt Mackall -
r25631:2748bf78 default
parent child Browse files
Show More
@@ -1093,6 +1093,11 command or with Mercurial Queues extensi
1093 of line, patch line endings are preserved.
1093 of line, patch line endings are preserved.
1094 Default: strict.
1094 Default: strict.
1095
1095
1096 ``fuzz``
1097 The number of lines of 'fuzz' to allow when applying patches. This
1098 controls how much context the patcher is allowed to ignore when
1099 trying to apply a patch.
1100 Default: 2
1096
1101
1097 ``paths``
1102 ``paths``
1098 ---------
1103 ---------
@@ -773,7 +773,7 class patchfile(object):
773 for x, s in enumerate(self.lines):
773 for x, s in enumerate(self.lines):
774 self.hash.setdefault(s, []).append(x)
774 self.hash.setdefault(s, []).append(x)
775
775
776 for fuzzlen in xrange(3):
776 for fuzzlen in xrange(self.ui.configint("patch", "fuzz", 2) + 1):
777 for toponly in [True, False]:
777 for toponly in [True, False]:
778 old, oldstart, new, newstart = h.fuzzit(fuzzlen, toponly)
778 old, oldstart, new, newstart = h.fuzzit(fuzzlen, toponly)
779 oldstart = oldstart + self.offset + self.skew
779 oldstart = oldstart + self.offset + self.skew
@@ -492,6 +492,13 Test fuzziness (ambiguous patch location
492 $ echo line0 >> a
492 $ echo line0 >> a
493 $ hg ci -m brancha
493 $ hg ci -m brancha
494 created new head
494 created new head
495 $ hg import --config patch.fuzz=0 -v fuzzy-tip.patch
496 applying fuzzy-tip.patch
497 patching file a
498 Hunk #1 FAILED at 0
499 1 out of 1 hunks FAILED -- saving rejects to file a.rej
500 abort: patch failed to apply
501 [255]
495 $ hg import --no-commit -v fuzzy-tip.patch
502 $ hg import --no-commit -v fuzzy-tip.patch
496 applying fuzzy-tip.patch
503 applying fuzzy-tip.patch
497 patching file a
504 patching file a
General Comments 0
You need to be logged in to leave comments. Login now