[Pkg-bazaar-commits] ./bzr/unstable r189: improved new-inventory

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:44:03 UTC 2009


------------------------------------------------------------
revno: 189
committer: mbp at sourcefrog.net
timestamp: Thu 2005-04-07 15:56:55 +1000
message:
  improved new-inventory
modified:
  bzrlib/newinventory.py
-------------- next part --------------
=== modified file 'bzrlib/newinventory.py'
--- a/bzrlib/newinventory.py	2005-04-07 05:47:05 +0000
+++ b/bzrlib/newinventory.py	2005-04-07 05:56:55 +0000
@@ -19,8 +19,10 @@
 
 def write_inventory(inv, f):
     el = Element('inventory', {'version': '2'})
+    el.text = '\n'
     
     root = Element('root_directory', {'id': inv.root.file_id})
+    root.tail = root.text = '\n'
     el.append(root)
 
     def descend(parent_el, ie):
@@ -42,6 +44,7 @@
         parent_el.append(el)
 
         if kind == 'directory':
+            el.text = '\n' # break before having children
             l = ie.children.items()
             l.sort()
             for child_name, child_ie in l:
@@ -50,7 +53,7 @@
         
     # walk down through inventory, adding all directories
 
-    l = inv._root.children.items()
+    l = inv.root.children.items()
     l.sort()
     for entry_name, ie in l:
         descend(root, ie)
@@ -89,7 +92,7 @@
     f.write('<inventory>\n')
     f.write('<root_directory id="bogus-root-id">\n')
 
-    l = inv._root.children.items()
+    l = inv.root.children.items()
     l.sort()
     for entry_name, ie in l:
         descend(ie)
@@ -128,4 +131,4 @@
 
     inv = Inventory()
     for el in root_el:
-        descend(inv._root, el)
+        descend(inv.root, el)



More information about the Pkg-bazaar-commits mailing list