Rev 3527: One code path was using a tuple, another a plain path in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/multi_walker
John Arbash Meinel
john at arbash-meinel.com
Fri Aug 1 18:48:33 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/multi_walker
------------------------------------------------------------
revno: 3527
revision-id: john at arbash-meinel.com-20080801174830-xyg2tor1j4zjklpj
parent: john at arbash-meinel.com-20080801172424-rwe2i959lhuwe4jt
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: multi_walker
timestamp: Fri 2008-08-01 12:48:30 -0500
message:
One code path was using a tuple, another a plain path
we need to support *both*. Relatively simple fix after that.
modified:
bzrlib/tests/test_tree.py test_tree.py-20060724065232-khgrr0vvmt6ih0mi-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
-------------- next part --------------
=== modified file 'bzrlib/tests/test_tree.py'
--- a/bzrlib/tests/test_tree.py 2008-08-01 17:24:24 +0000
+++ b/bzrlib/tests/test_tree.py 2008-08-01 17:48:30 +0000
@@ -409,11 +409,11 @@
self.assertCmpByDirblock(1, u'a-a/a/a', u'a/a/a')
self.assertCmpByDirblock(1, u'a=a/a/a', u'a/a/a')
- def assertPathKey(self, expected, path):
- self.assertEqual(expected, _mod_tree.MultiWalker._path_key(path))
+ def assertPathToKey(self, expected, path):
+ self.assertEqual(expected, _mod_tree.MultiWalker._path_to_key(path))
- def test__path_key(self):
- self.assertPathKey(([u''], u''), u'')
- self.assertPathKey(([u''], u'a'), u'a')
- self.assertPathKey(([u'a'], u'b'), u'a/b')
- self.assertPathKey(([u'a', u'b'], u'c'), u'a/b/c')
+ def test__path_to_key(self):
+ self.assertPathToKey(([u''], u''), u'')
+ self.assertPathToKey(([u''], u'a'), u'a')
+ self.assertPathToKey(([u'a'], u'b'), u'a/b')
+ self.assertPathToKey(([u'a', u'b'], u'c'), u'a/b/c')
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2008-08-01 17:24:24 +0000
+++ b/bzrlib/tree.py 2008-08-01 17:48:30 +0000
@@ -977,10 +977,11 @@
if not isinstance(path2, unicode):
raise TypeError("'path2' must be a unicode string, not %s: %r"
% (type(path2), path2))
- return cmp(MultiWalker._path_key(path1), MultiWalker._path_key(path2))
+ return cmp(MultiWalker._path_to_key(path1),
+ MultiWalker._path_to_key(path2))
@staticmethod
- def _path_key(path):
+ def _path_to_key(path):
dirname, basename = osutils.split(path)
return (dirname.split(u'/'), basename)
@@ -1120,7 +1121,8 @@
# might ensure better ordering, in case a caller strictly
# requires parents before children.
for idx, other_extra in enumerate(self._others_extra):
- others = sorted(other_extra.itervalues(), key=self._path_key)
+ others = sorted(other_extra.itervalues(),
+ key=lambda x: self._path_to_key(x[0]))
for other_path, other_ie in others:
file_id = other_ie.file_id
# We don't need to check out_of_order_processed here, because
More information about the bazaar-commits
mailing list