1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006-2011 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
2682
2682
trace.mutter("set_state_from_inventory complete.")
2684
def set_state_from_scratch(self, working_inv, parent_trees, parent_ghosts):
2685
"""Wipe the currently stored state and set it to something new.
2687
This is a hard-reset for the data we are working with.
2689
# Technically, we really want a write lock, but until we write, we
2690
# don't really need it.
2691
self._requires_lock()
2692
# root dir and root dir contents with no children. We have to have a
2693
# root for set_state_from_inventory to work correctly.
2694
empty_root = (('', '', inventory.ROOT_ID),
2695
[('d', '', 0, False, DirState.NULLSTAT)])
2696
empty_tree_dirblocks = [('', [empty_root]), ('', [])]
2697
self._set_data([], empty_tree_dirblocks)
2698
self.set_state_from_inventory(working_inv)
2699
self.set_parent_trees(parent_trees, parent_ghosts)
2684
2701
def _make_absent(self, current_old):
2685
2702
"""Mark current_old - an entry - as absent for tree 0.