Rev 4512: Handle unicode parents correctly in dirstate parent checking. in http://bazaar.launchpad.net/~lifeless/bzr/apply-inventory-delta
Robert Collins
robertc at robertcollins.net
Fri Jul 10 03:33:57 BST 2009
At http://bazaar.launchpad.net/~lifeless/bzr/apply-inventory-delta
------------------------------------------------------------
revno: 4512
revision-id: robertc at robertcollins.net-20090710023346-hkohwlngffgw71z1
parent: robertc at robertcollins.net-20090709230439-vztby1svjthvodkv
committer: Robert Collins <robertc at robertcollins.net>
branch nick: apply-inventory-delta
timestamp: Fri 2009-07-10 12:33:46 +1000
message:
Handle unicode parents correctly in dirstate parent checking.
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2009-07-09 23:04:39 +0000
+++ b/bzrlib/dirstate.py 2009-07-10 02:33:46 +0000
@@ -1407,12 +1407,15 @@
if inv_entry is not None and file_id != inv_entry.file_id:
raise errors.InconsistentDelta(new_path, file_id,
"mismatched entry file_id %r" % inv_entry)
+ if new_path is not None:
+ new_path_utf8 = encode(new_path)
+ # note the parent for validation
+ dirname, basename = osutils.split(new_path_utf8)
+ if basename:
+ parents.add((dirname, inv_entry.parent_id))
if old_path is None:
adds.append((None, encode(new_path), file_id,
inv_to_entry(inv_entry), True))
- # note the parent for validation
- dirname, basename = osutils.split(new_path)
- parents.add((dirname, inv_entry.parent_id))
elif new_path is None:
deletes.append((encode(old_path), None, file_id, None, True))
elif (old_path, new_path) != root_only:
@@ -1430,7 +1433,6 @@
# for 'r' items on every pass.
self._update_basis_apply_deletes(deletes)
deletes = []
- new_path_utf8 = encode(new_path)
# Split into an add/delete pair recursively.
adds.append((None, new_path_utf8, file_id,
inv_to_entry(inv_entry), False))
=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py 2009-07-09 23:04:39 +0000
+++ b/bzrlib/tests/test_inv.py 2009-07-10 02:33:46 +0000
@@ -246,7 +246,7 @@
file2.revision = 'result'
file2.text_size = 0
file2.text_sha1 = ""
- delta = [(None, 'path1', 'id', file1), (None, 'path2', 'id', file2)]
+ delta = [(None, u'path1', 'id', file1), (None, u'path2', 'id', file2)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
@@ -260,7 +260,7 @@
file2.revision = 'result'
file2.text_size = 0
file2.text_sha1 = ""
- delta = [(None, 'path', 'id1', file1), (None, 'path', 'id2', file2)]
+ delta = [(None, u'path', 'id1', file1), (None, u'path', 'id2', file2)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
@@ -282,7 +282,7 @@
file2.text_sha1 = ""
inv.add(file1)
inv.add(file2)
- delta = [('path', None, 'id1', None), ('path', None, 'id2', None)]
+ delta = [(u'path', None, 'id1', None), (u'path', None, 'id2', None)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
@@ -292,7 +292,7 @@
file1.revision = 'result'
file1.text_size = 0
file1.text_sha1 = ""
- delta = [(None, 'path', 'id', file1)]
+ delta = [(None, u'path', 'id', file1)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
@@ -307,7 +307,7 @@
file2.text_size = 0
file2.text_sha1 = ""
inv.add(file1)
- delta = [(None, 'path/path2', 'id2', file2)]
+ delta = [(None, u'path/path2', 'id2', file2)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
@@ -317,7 +317,7 @@
file2.revision = 'result'
file2.text_size = 0
file2.text_sha1 = ""
- delta = [(None, 'path/path2', 'id2', file2)]
+ delta = [(None, u'path/path2', 'id2', file2)]
self.assertRaises(errors.InconsistentDelta, self.apply_delta, self,
inv, delta)
More information about the bazaar-commits
mailing list