Rev 2303: Minor performance improvement, use None as signal rather than ROOT_ID in http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/utf8_file_ids
John Arbash Meinel
john at arbash-meinel.com
Sat Feb 17 22:25:46 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.15-dev/utf8_file_ids
------------------------------------------------------------
revno: 2303
revision-id: john at arbash-meinel.com-20070217222537-p0hxseinc3x84e96
parent: john at arbash-meinel.com-20070217221226-op8ol98ngy4219fd
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: utf8_file_ids
timestamp: Sat 2007-02-17 16:25:37 -0600
message:
Minor performance improvement, use None as signal rather than ROOT_ID
for xml5 inventories. Discover small bug in serialized text because of this.
modified:
bzrlib/tests/test_xml.py test_xml.py-20050905091053-80b45588931a9b35
bzrlib/xml5.py xml5.py-20050907032657-aac8f960815b66b1
bzrlib/xml6.py xml6.py-20060823042456-dbaaq4atrche7xy5-1
-------------- next part --------------
=== modified file 'bzrlib/tests/test_xml.py'
--- a/bzrlib/tests/test_xml.py 2007-02-17 21:54:17 +0000
+++ b/bzrlib/tests/test_xml.py 2007-02-17 22:25:37 +0000
@@ -146,11 +146,11 @@
_inventory_utf8_v5 = """<inventory file_id="TREé_ROOT" format="5"
revision_id="erik at bågfors-02">
<file file_id="bår-01"
- name="bår" parent_id="TREE_ROOT"
+ name="bår" parent_id="TREé_ROOT"
revision="erik at bågfors-01"/>
<directory name="sµbdir"
file_id="sµbdir-01"
- parent_id="TREE_ROOT"
+ parent_id="TREé_ROOT"
revision="erik at bågfors-01"/>
<file executable="yes" file_id="bår-02"
name="bår" parent_id="sµbdir-01"
=== modified file 'bzrlib/xml5.py'
--- a/bzrlib/xml5.py 2007-02-09 23:15:53 +0000
+++ b/bzrlib/xml5.py 2007-02-17 22:25:37 +0000
@@ -286,12 +286,12 @@
inv = Inventory(root_id, revision_id=revision_id)
for e in elt:
ie = self._unpack_entry(e)
- if ie.parent_id == ROOT_ID:
+ if ie.parent_id is None:
ie.parent_id = root_id
inv.add(ie)
return inv
- def _unpack_entry(self, elt, none_parents=False):
+ def _unpack_entry(self, elt):
kind = elt.tag
if not InventoryEntry.versionable_kind(kind):
raise AssertionError('unsupported entry kind %s' % kind)
@@ -299,8 +299,6 @@
get_cached = _get_utf8_or_ascii
parent_id = elt.get('parent_id')
- if parent_id is None and not none_parents:
- parent_id = ROOT_ID
# TODO: jam 20060817 At present, caching file ids costs us too
# much time. It slows down overall read performances from
# approx 500ms to 700ms. And doesn't improve future reads.
=== modified file 'bzrlib/xml6.py'
--- a/bzrlib/xml6.py 2007-02-10 02:48:43 +0000
+++ b/bzrlib/xml6.py 2007-02-17 22:25:37 +0000
@@ -45,7 +45,7 @@
revision_id = cache_utf8.encode(revision_id)
inv = inventory.Inventory(root_id=None, revision_id=revision_id)
for e in elt:
- ie = self._unpack_entry(e, none_parents=True)
+ ie = self._unpack_entry(e)
inv.add(ie)
return inv
More information about the bazaar-commits
mailing list