[MERGE] lazy inventory writes

Aaron Bentley aaron.bentley at utoronto.ca
Mon Oct 9 04:21:46 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> WorkingTree currently writes the inventory on nearly every mutation
> operation. This patch adds the facility for us to write it only on
> unlock, and updates set_root_id to use this. This combined with a minor
> change to tree initialisation gives us only one inventory write to disk
> during tree creation.

This sounds reasonable.  +1 except for two things:

> @@ -1018,7 +1054,7 @@
>                              ["rename rolled back"])
>          except:
>              # restore the inventory on error
> -            self._set_inventory(orig_inv)
> +            self._set_inventory(orig_inv, dirty=original_modified)
>              raise
>          self._write_inventory(inv)

Shouldn't this be removed?

> @@ -1555,16 +1600,31 @@
>      @needs_tree_write_lock
>      def set_root_id(self, file_id):
>          """Set the root id for this tree."""
> -        inv = self.read_working_inventory()
> +        # for compatability 
> +        if file_id is None:
> +            symbol_versioning.warn(symbol_versioning.zero_twelve
> +                % 'WorkingTree.set_root_id with fileid=None',
> +                DeprecationWarning,
> +                stacklevel=3)
> +            file_id = ROOT_ID
> +        inv = self._inventory

How do we know self._inventory isn't None?

And yes, I agree we should deprecate setting root_id to None.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFKcBK0F+nu1YWqI0RAjtvAJ9YnSKYVs94gaEvHo8y4SBpb1vafwCfXo8z
lmkLtt+lPj0D7W5ieji99bE=
=E7ob
-----END PGP SIGNATURE-----





More information about the bazaar mailing list