Rev 2542: Review feedback from Martin, mostly documentation updates. in http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
John Arbash Meinel
john at arbash-meinel.com
Fri Jul 13 18:54:58 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.17-dev/dirstate_pyrex
------------------------------------------------------------
revno: 2542
revision-id: john at arbash-meinel.com-20070713175009-sylhp1kst6145v0f
parent: john at arbash-meinel.com-20070712181059-xnomv3tzzsb2hpx5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_pyrex
timestamp: Fri 2007-07-13 12:50:09 -0500
message:
Review feedback from Martin, mostly documentation updates.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-07-12 18:10:59 +0000
+++ b/NEWS 2007-07-13 17:50:09 +0000
@@ -11,8 +11,8 @@
* ``DirState._read_dirblocks`` now has an optional Pyrex
implementation. This improves the speed of any command that has to
- read the entire DirState (atm, all commands that effect the working
- tree, ``diff``, ``status``, etc).
+ read the entire DirState. (``diff``, ``status``, etc, improve by
+ about 10%).
``bisect_dirblocks`` has also been improved, which helps all
``_get_entry`` type calls (whenever we are searching for a
particular entry in the in-memory DirState).
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2007-07-11 23:45:20 +0000
+++ b/bzrlib/tests/__init__.py 2007-07-13 17:50:09 +0000
@@ -835,6 +835,14 @@
self.assertEqual(mode, mode_test,
'mode mismatch %o != %o' % (mode, mode_test))
+ def assertPositive(self, val):
+ """Assert that val is greater than 0."""
+ self.assertTrue(val > 0, 'expected a positive value, but got %s' % val)
+
+ def assertNegative(self, val):
+ """Assert that val is less than 0."""
+ self.assertTrue(val < 0, 'expected a negative value, but got %s' % val)
+
def assertStartsWith(self, s, prefix):
if not s.startswith(prefix):
raise AssertionError('string %r does not start with %r' % (s, prefix))
=== modified file 'bzrlib/tests/test__dirstate_helpers.py'
--- a/bzrlib/tests/test__dirstate_helpers.py 2007-07-12 16:34:02 +0000
+++ b/bzrlib/tests/test__dirstate_helpers.py 2007-07-13 17:50:09 +0000
@@ -46,6 +46,10 @@
_bisect_path_* is intended to work like bisect.bisect_*() except it
knows it is working on paths that are sorted by ('path', 'to', 'foo')
chunks rather than by raw 'path/to/foo'.
+
+ Test Cases should inherit from this and override ``get_bisect_path`` return
+ their implementation, and ``get_bisect`` to return the matching
+ bisect.bisect_* function.
"""
def get_bisect_path(self):
@@ -192,6 +196,7 @@
class TestBisectPathLeft(tests.TestCase, TestBisectPathMixin):
+ """Run all Bisect Path tests against _bisect_path_left_py."""
def get_bisect_path(self):
from bzrlib._dirstate_helpers_py import _bisect_path_left_py
@@ -202,11 +207,7 @@
class TestCompiledBisectPathLeft(TestBisectPathLeft):
- """Test that _bisect_path_left() returns the expected values.
-
- This runs all the normal tests that TestBisectDirblock did, but uses the
- compiled version.
- """
+ """Run all Bisect Path tests against _bisect_path_right_c"""
_test_needs_features = [CompiledDirstateHelpersFeature]
@@ -216,6 +217,7 @@
class TestBisectPathRight(tests.TestCase, TestBisectPathMixin):
+ """Run all Bisect Path tests against _bisect_path_right_py"""
def get_bisect_path(self):
from bzrlib._dirstate_helpers_py import _bisect_path_right_py
@@ -226,11 +228,7 @@
class TestCompiledBisectPathRight(TestBisectPathRight):
- """Test that _bisect_path_right() returns the expected values.
-
- This runs all the normal tests that TestBisectDirblock did, but uses the
- compiled version.
- """
+ """Run all Bisect Path tests against _bisect_path_right_c"""
_test_needs_features = [CompiledDirstateHelpersFeature]
@@ -245,6 +243,10 @@
bisect_dirblock is intended to work like bisect.bisect_left() except it
knows it is working on dirblocks and that dirblocks are sorted by ('path',
'to', 'foo') chunks rather than by raw 'path/to/foo'.
+
+ This test is parameterized by calling get_bisect_dirblock(). Child test
+ cases can override this function to test against a different
+ implementation.
"""
def get_bisect_dirblock(self):
@@ -348,20 +350,20 @@
class TestCmpByDirs(tests.TestCase):
+ """Test an implementation of cmp_by_dirs()
+
+ cmp_by_dirs() compares 2 paths by their directory sections, rather than as
+ plain strings.
+
+ Child test cases can override ``get_cmp_by_dirs`` to test a specific
+ implementation.
+ """
def get_cmp_by_dirs(self):
"""Get a specific implementation of cmp_by_dirs."""
from bzrlib._dirstate_helpers_py import cmp_by_dirs_py
return cmp_by_dirs_py
- def assertPositive(self, val):
- """Assert that val is greater than 0."""
- self.assertTrue(val > 0, 'expected a positive value, but got %s' % val)
-
- def assertNegative(self, val):
- """Assert that val is less than 0."""
- self.assertTrue(val < 0, 'expected a negative value, but got %s' % val)
-
def assertCmpByDirs(self, expected, str1, str2):
"""Compare the two strings, in both directions.
@@ -457,6 +459,14 @@
class TestCmpPathByDirblock(tests.TestCase):
+ """Test an implementation of _cmp_path_by_dirblock()
+
+ _cmp_path_by_dirblock() compares two paths using the sort order used by
+ DirState. All paths in the same directory are sorted together.
+
+ Child test cases can override ``get_cmp_path_by_dirblock`` to test a specific
+ implementation.
+ """
def get_cmp_path_by_dirblock(self):
"""Get a specific implementation of _cmp_path_by_dirblock."""
@@ -616,6 +626,14 @@
class TestReadDirblocks(test_dirstate.TestCaseWithDirState):
+ """Test an implementation of _read_dirblocks()
+
+ _read_dirblocks() reads in all of the dirblock information from the disk
+ file.
+
+ Child test cases can override ``get_read_dirblocks`` to test a specific
+ implementation.
+ """
def get_read_dirblocks(self):
from bzrlib._dirstate_helpers_py import _read_dirblocks_py
@@ -635,6 +653,7 @@
class TestCompiledReadDirblocks(TestReadDirblocks):
+ """Test the pyrex implementation of _read_dirblocks"""
_test_needs_features = [CompiledDirstateHelpersFeature]
More information about the bazaar-commits
mailing list