# HG changeset patch # User Yuya Nishihara # Date 1493211817 -32400 # Node ID ded48ad5514626a319dc11eb5e198abb471f582a # Parent 4462a981e8df8046e4c49aeb02d501cd192607b0 bdiff: proxy through mdiff module See the previous commit for why. mdiff seems a good place to host bdiff functions. bdiff.bdiff was already aliased as textdiff, so we use it. diff -r 4462a981e8df -r ded48ad55146 contrib/bdiff-torture.py --- a/contrib/bdiff-torture.py Wed Apr 26 21:56:47 2017 +0900 +++ b/contrib/bdiff-torture.py Wed Apr 26 22:03:37 2017 +0900 @@ -5,7 +5,7 @@ import sys from mercurial import ( - bdiff, + mdiff, mpatch, ) @@ -42,7 +42,7 @@ sys.exit(0) def test1(a, b): - d = bdiff.bdiff(a, b) + d = mdiff.textdiff(a, b) if not d: raise ValueError("empty") c = mpatch.patches(a, [d]) diff -r 4462a981e8df -r ded48ad55146 contrib/perf.py --- a/contrib/perf.py Wed Apr 26 21:56:47 2017 +0900 +++ b/contrib/perf.py Wed Apr 26 22:03:37 2017 +0900 @@ -26,7 +26,6 @@ import sys import time from mercurial import ( - bdiff, changegroup, cmdutil, commands, @@ -812,7 +811,7 @@ def d(): for pair in textpairs: - bdiff.bdiff(*pair) + mdiff.textdiff(*pair) timer, fm = gettimer(ui, opts) timer(d) diff -r 4462a981e8df -r ded48ad55146 mercurial/mdiff.py --- a/mercurial/mdiff.py Wed Apr 26 21:56:47 2017 +0900 +++ b/mercurial/mdiff.py Wed Apr 26 22:03:37 2017 +0900 @@ -20,6 +20,8 @@ util, ) +blocks = bdiff.blocks +fixws = bdiff.fixws patches = mpatch.patches patchedsize = mpatch.patchedsize textdiff = bdiff.bdiff diff -r 4462a981e8df -r ded48ad55146 mercurial/similar.py --- a/mercurial/similar.py Wed Apr 26 21:56:47 2017 +0900 +++ b/mercurial/similar.py Wed Apr 26 22:03:37 2017 +0900 @@ -9,7 +9,6 @@ from .i18n import _ from . import ( - bdiff, mdiff, ) @@ -56,10 +55,10 @@ def _score(fctx, otherdata): orig, lines = otherdata text = fctx.data() - # bdiff.blocks() returns blocks of matching lines + # mdiff.blocks() returns blocks of matching lines # count the number of bytes in each equal = 0 - matches = bdiff.blocks(text, orig) + matches = mdiff.blocks(text, orig) for x1, x2, y1, y2 in matches: for line in lines[y1:y2]: equal += len(line) diff -r 4462a981e8df -r ded48ad55146 tests/test-bdiff.py --- a/tests/test-bdiff.py Wed Apr 26 21:56:47 2017 +0900 +++ b/tests/test-bdiff.py Wed Apr 26 22:03:37 2017 +0900 @@ -4,7 +4,7 @@ import unittest from mercurial import ( - bdiff, + mdiff, mpatch, ) @@ -16,7 +16,7 @@ class BdiffTests(unittest.TestCase): def assert_bdiff_applies(self, a, b): - d = bdiff.bdiff(a, b) + d = mdiff.textdiff(a, b) c = a if d: c = mpatch.patches(a, [d]) @@ -54,7 +54,7 @@ self.assert_bdiff(a, b) def showdiff(self, a, b): - bin = bdiff.bdiff(a, b) + bin = mdiff.textdiff(a, b) pos = 0 q = 0 actions = [] @@ -110,7 +110,7 @@ ("", "", 0), ] for a, b, allws in cases: - c = bdiff.fixws(a, allws) + c = mdiff.fixws(a, allws) self.assertEqual( c, b, 'fixws(%r) want %r got %r (allws=%r)' % (a, b, c, allws)) diff -r 4462a981e8df -r ded48ad55146 tests/test-check-code.t --- a/tests/test-check-code.t Wed Apr 26 21:56:47 2017 +0900 +++ b/tests/test-check-code.t Wed Apr 26 22:03:37 2017 +0900 @@ -9,7 +9,7 @@ $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman | > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false - contrib/perf.py:869: + contrib/perf.py:868: > r.revision(r.node(x)) don't convert rev to node before passing to revision(nodeorrev) Skipping i18n/polib.py it has no-che?k-code (glob) diff -r 4462a981e8df -r ded48ad55146 tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t Wed Apr 26 21:56:47 2017 +0900 +++ b/tests/test-contrib-perf.t Wed Apr 26 22:03:37 2017 +0900 @@ -165,7 +165,7 @@ $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py; > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) | > "$TESTDIR"/check-perf-code.py contrib/perf.py - contrib/perf.py:869: + contrib/perf.py:868: > r.revision(r.node(x)) don't convert rev to node before passing to revision(nodeorrev) [1]