/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

Added support for all-file path ids

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
        self._new_parent = {}
21
21
        self._new_contents = {}
22
22
        self._new_id = {}
 
23
        self._tree_path_ids = {}
23
24
        self._new_root = self.get_id_tree(tree.get_root_id())
24
25
 
25
26
    def finalize(self):
51
52
        This reflects only files that already exist, not ones that will be
52
53
        added by transactions.
53
54
        """
54
 
        if inventory_id not in self._tree:
55
 
            raise Exception('ID not in tree')
56
 
        return 'tree-%s' % inventory_id
 
55
        return self.get_tree_path_id(self._tree.id2path(inventory_id))
 
56
 
 
57
    def get_tree_path_id(self, path):
 
58
        """Determine (and maybe set) the transaction ID for a tree path."""
 
59
        path = os.path.realpath(path)
 
60
        if path not in self._tree_path_ids:
 
61
            self._tree_path_ids[path] = self._assign_id()
 
62
        return self._tree_path_ids[path]
57
63
 
58
64
    def create_file(self, contents, trans_id):
59
65
        """Create a new, possibly versioned, file.
97
103
                last_trans_id = trans_id
98
104
        return conflicts
99
105
            
100
 
            
101
106
    def apply(self):
102
107
        if len(self.find_conflicts()) != 0:
103
108
            raise MalformedTransform()