/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 breezy/transform.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 05:10:44 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20190304051044-vph4s8p9qvpy2qe9
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
604
604
 
605
605
        :param name: The basename of the file.
606
606
 
607
 
        :param target_id: The directory trans_id where the backup should 
 
607
        :param target_id: The directory trans_id where the backup should
608
608
            be placed.
609
609
        """
610
610
        known_children = self.by_parent().get(target_id, [])
720
720
    def _duplicate_ids(self):
721
721
        """Each inventory id may only be used once"""
722
722
        conflicts = []
 
723
        try:
 
724
            all_ids = self._tree.all_file_ids()
 
725
        except errors.UnsupportedOperation:
 
726
            # it's okay for non-file-id trees to raise UnsupportedOperation.
 
727
            return []
723
728
        removed_tree_ids = set((self.tree_file_id(trans_id) for trans_id in
724
729
                                self._removed_id))
725
 
        all_ids = self._tree.all_file_ids()
726
730
        active_tree_ids = all_ids.difference(removed_tree_ids)
727
731
        for trans_id, file_id in viewitems(self._new_id):
728
732
            if file_id in active_tree_ids:
1792
1796
                    continue
1793
1797
                kind = self.final_kind(trans_id)
1794
1798
                if kind is None:
1795
 
                    kind = self._tree.stored_kind(
1796
 
                        self._tree.id2path(file_id), file_id)
 
1799
                    kind = self._tree.stored_kind(self._tree.id2path(file_id))
1797
1800
                parent_trans_id = self.final_parent(trans_id)
1798
1801
                parent_file_id = new_path_file_ids.get(parent_trans_id)
1799
1802
                if parent_file_id is None:
2064
2067
        return tree_ids
2065
2068
 
2066
2069
    def all_versioned_paths(self):
2067
 
        return {self.id2path(fid) for fid in self.all_file_ids()}
 
2070
        tree_paths = set(self._transform._tree.all_versioned_paths())
 
2071
 
 
2072
        tree_paths.difference_update(
 
2073
            self._transform.trans_id_tree_path(t)
 
2074
            for t in self._transform._removed_id)
 
2075
 
 
2076
        tree_paths.update(
 
2077
            self._final_paths._determine_path(t)
 
2078
            for t in self._transform._new_id)
 
2079
 
 
2080
        return tree_paths
2068
2081
 
2069
2082
    def _has_id(self, file_id, fallback_check):
2070
2083
        if file_id in self._transform._r_new_id:
2153
2166
            kind = self._transform.final_kind(trans_id)
2154
2167
            if kind is None:
2155
2168
                kind = self._transform._tree.stored_kind(
2156
 
                    self._transform._tree.id2path(file_id),
2157
 
                    file_id)
 
2169
                    self._transform._tree.id2path(file_id))
2158
2170
            new_entry = inventory.make_entry(
2159
2171
                kind,
2160
2172
                self._transform.final_name(trans_id),
2226
2238
                    if not path.startswith(prefix):
2227
2239
                        continue
2228
2240
                    path = path[len(prefix):]
2229
 
                yield path, 'V', entry.kind, entry.file_id, entry
 
2241
                yield path, 'V', entry.kind, entry
2230
2242
        else:
2231
2243
            if from_dir is None and include_root is True:
2232
 
                root_entry = inventory.make_entry('directory', '',
2233
 
                                                  ROOT_PARENT, self.get_root_id())
2234
 
                yield '', 'V', 'directory', root_entry.file_id, root_entry
 
2244
                root_entry = inventory.make_entry(
 
2245
                    'directory', '', ROOT_PARENT, self.get_root_id())
 
2246
                yield '', 'V', 'directory', root_entry
2235
2247
            entries = self._iter_entries_for_dir(from_dir or '')
2236
2248
            for path, entry in entries:
2237
 
                yield path, 'V', entry.kind, entry.file_id, entry
 
2249
                yield path, 'V', entry.kind, entry
2238
2250
 
2239
2251
    def kind(self, path):
2240
2252
        trans_id = self._path2trans_id(path)
2695
2707
                tt.create_hardlink(accelerator_tree.abspath(accelerator_path),
2696
2708
                                   trans_id)
2697
2709
            else:
2698
 
                with accelerator_tree.get_file(accelerator_path, file_id) as f:
 
2710
                with accelerator_tree.get_file(accelerator_path) as f:
2699
2711
                    chunks = osutils.file_iterator(f)
2700
2712
                    if wt.supports_content_filtering():
2701
2713
                        filters = wt._content_filter_stack(tree_path)
3110
3122
            file_id = tt.inactive_file_id(conflict[1])
3111
3123
            # special-case the other tree root (move its children instead)
3112
3124
            if path_tree and path_tree.path2id('') == file_id:
3113
 
                    # This is the root entry, skip it
 
3125
                # This is the root entry, skip it
3114
3126
                continue
3115
3127
            tt.version_file(file_id, conflict[1])
3116
3128
            new_conflicts.add((c_type, 'Versioned directory', conflict[1]))