##// END OF EJS Templates
bdiff: proxy through mdiff module...
Yuya Nishihara -
r32201:ded48ad5 default
parent child Browse files
Show More
@@ -5,7 +5,7 b' import random'
5 import sys
5 import sys
6
6
7 from mercurial import (
7 from mercurial import (
8 bdiff,
8 mdiff,
9 mpatch,
9 mpatch,
10 )
10 )
11
11
@@ -42,7 +42,7 b' def reducetest(a, b):'
42 sys.exit(0)
42 sys.exit(0)
43
43
44 def test1(a, b):
44 def test1(a, b):
45 d = bdiff.bdiff(a, b)
45 d = mdiff.textdiff(a, b)
46 if not d:
46 if not d:
47 raise ValueError("empty")
47 raise ValueError("empty")
48 c = mpatch.patches(a, [d])
48 c = mpatch.patches(a, [d])
@@ -26,7 +26,6 b' import random'
26 import sys
26 import sys
27 import time
27 import time
28 from mercurial import (
28 from mercurial import (
29 bdiff,
30 changegroup,
29 changegroup,
31 cmdutil,
30 cmdutil,
32 commands,
31 commands,
@@ -812,7 +811,7 b' def perfbdiff(ui, repo, file_, rev=None,'
812
811
813 def d():
812 def d():
814 for pair in textpairs:
813 for pair in textpairs:
815 bdiff.bdiff(*pair)
814 mdiff.textdiff(*pair)
816
815
817 timer, fm = gettimer(ui, opts)
816 timer, fm = gettimer(ui, opts)
818 timer(d)
817 timer(d)
@@ -20,6 +20,8 b' from . import ('
20 util,
20 util,
21 )
21 )
22
22
23 blocks = bdiff.blocks
24 fixws = bdiff.fixws
23 patches = mpatch.patches
25 patches = mpatch.patches
24 patchedsize = mpatch.patchedsize
26 patchedsize = mpatch.patchedsize
25 textdiff = bdiff.bdiff
27 textdiff = bdiff.bdiff
@@ -9,7 +9,6 b' from __future__ import absolute_import'
9
9
10 from .i18n import _
10 from .i18n import _
11 from . import (
11 from . import (
12 bdiff,
13 mdiff,
12 mdiff,
14 )
13 )
15
14
@@ -56,10 +55,10 b' def _ctxdata(fctx):'
56 def _score(fctx, otherdata):
55 def _score(fctx, otherdata):
57 orig, lines = otherdata
56 orig, lines = otherdata
58 text = fctx.data()
57 text = fctx.data()
59 # bdiff.blocks() returns blocks of matching lines
58 # mdiff.blocks() returns blocks of matching lines
60 # count the number of bytes in each
59 # count the number of bytes in each
61 equal = 0
60 equal = 0
62 matches = bdiff.blocks(text, orig)
61 matches = mdiff.blocks(text, orig)
63 for x1, x2, y1, y2 in matches:
62 for x1, x2, y1, y2 in matches:
64 for line in lines[y1:y2]:
63 for line in lines[y1:y2]:
65 equal += len(line)
64 equal += len(line)
@@ -4,7 +4,7 b' import struct'
4 import unittest
4 import unittest
5
5
6 from mercurial import (
6 from mercurial import (
7 bdiff,
7 mdiff,
8 mpatch,
8 mpatch,
9 )
9 )
10
10
@@ -16,7 +16,7 b' class diffreplace('
16 class BdiffTests(unittest.TestCase):
16 class BdiffTests(unittest.TestCase):
17
17
18 def assert_bdiff_applies(self, a, b):
18 def assert_bdiff_applies(self, a, b):
19 d = bdiff.bdiff(a, b)
19 d = mdiff.textdiff(a, b)
20 c = a
20 c = a
21 if d:
21 if d:
22 c = mpatch.patches(a, [d])
22 c = mpatch.patches(a, [d])
@@ -54,7 +54,7 b' class BdiffTests(unittest.TestCase):'
54 self.assert_bdiff(a, b)
54 self.assert_bdiff(a, b)
55
55
56 def showdiff(self, a, b):
56 def showdiff(self, a, b):
57 bin = bdiff.bdiff(a, b)
57 bin = mdiff.textdiff(a, b)
58 pos = 0
58 pos = 0
59 q = 0
59 q = 0
60 actions = []
60 actions = []
@@ -110,7 +110,7 b' class BdiffTests(unittest.TestCase):'
110 ("", "", 0),
110 ("", "", 0),
111 ]
111 ]
112 for a, b, allws in cases:
112 for a, b, allws in cases:
113 c = bdiff.fixws(a, allws)
113 c = mdiff.fixws(a, allws)
114 self.assertEqual(
114 self.assertEqual(
115 c, b, 'fixws(%r) want %r got %r (allws=%r)' % (a, b, c, allws))
115 c, b, 'fixws(%r) want %r got %r (allws=%r)' % (a, b, c, allws))
116
116
@@ -9,7 +9,7 b' New errors are not allowed. Warnings are'
9
9
10 $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
10 $ hg locate -X contrib/python-zstandard -X hgext/fsmonitor/pywatchman |
11 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
11 > sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
12 contrib/perf.py:869:
12 contrib/perf.py:868:
13 > r.revision(r.node(x))
13 > r.revision(r.node(x))
14 don't convert rev to node before passing to revision(nodeorrev)
14 don't convert rev to node before passing to revision(nodeorrev)
15 Skipping i18n/polib.py it has no-che?k-code (glob)
15 Skipping i18n/polib.py it has no-che?k-code (glob)
@@ -165,7 +165,7 b' Check perf.py for historical portability'
165 $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
165 $ (hg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
166 > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
166 > hg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
167 > "$TESTDIR"/check-perf-code.py contrib/perf.py
167 > "$TESTDIR"/check-perf-code.py contrib/perf.py
168 contrib/perf.py:869:
168 contrib/perf.py:868:
169 > r.revision(r.node(x))
169 > r.revision(r.node(x))
170 don't convert rev to node before passing to revision(nodeorrev)
170 don't convert rev to node before passing to revision(nodeorrev)
171 [1]
171 [1]
General Comments 0
You need to be logged in to leave comments. Login now