# HG changeset patch # User Patrick Mezard # Date 1195990926 -3600 # Node ID dccc127bfc0774389cf22817a426e04c9af3593d # Parent db6633f11d5972cfcd64b324575808f5b38a14f0# Parent 1fb38ef1f113c5ed11e3f1167dc13fe677048ea1 Merge with crew-stable diff -r db6633f11d59 -r dccc127bfc07 mercurial/patch.py --- a/mercurial/patch.py Sat Nov 24 20:16:59 2007 +0100 +++ b/mercurial/patch.py Sun Nov 25 12:42:06 2007 +0100 @@ -357,7 +357,7 @@ if len(cand) > 1: # resort our list of potentials forward then back. - cand.sort(cmp=sorter) + cand.sort(sorter) return cand def hashlines(self): diff -r db6633f11d59 -r dccc127bfc07 tests/test-import --- a/tests/test-import Sat Nov 24 20:16:59 2007 +0100 +++ b/tests/test-import Sun Nov 25 12:42:06 2007 +0100 @@ -129,3 +129,27 @@ hg --cwd b tip | grep someoneelse echo "% should be empty" hg --cwd b status + + +# Test fuzziness (ambiguous patch location, fuzz=2) +echo % test fuzziness +hg init fuzzy +cd fuzzy +echo line1 > a +echo line0 >> a +echo line3 >> a +hg ci -Am adda +echo line1 > a +echo line2 >> a +echo line0 >> a +echo line3 >> a +hg ci -m change a +hg export tip > tip.patch +hg up -C 0 +echo line1 > a +echo line0 >> a +echo line1 >> a +echo line0 >> a +hg ci -m brancha +hg import -v tip.patch +cd .. diff -r db6633f11d59 -r dccc127bfc07 tests/test-import.out --- a/tests/test-import.out Sat Nov 24 20:16:59 2007 +0100 +++ b/tests/test-import.out Sun Nov 25 12:42:06 2007 +0100 @@ -125,3 +125,10 @@ % committer should be 'someoneelse' user: someoneelse % should be empty +% test fuzziness +adding a +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +applying tip.patch +patching file a +Hunk #1 succeeded at 1 with fuzz 2 (offset -2 lines). +a