/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-07-26 00:52:04 UTC
  • mfrom: (7358.14.2 get-root-id)
  • Revision ID: breezy.the.bot@gmail.com-20190726005204-fapfcsnonmr0e3r3
Remove Tree.get_root_id() in favour of Tree.path2id('').

Merged from https://code.launchpad.net/~jelmer/brz/get-root-id/+merge/369477

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
            return None
456
456
        # the file is old; the old id is still valid
457
457
        if self._new_root == trans_id:
458
 
            return self._tree.get_root_id()
 
458
            return self._tree.path2id('')
459
459
        return self._tree.path2id(path)
460
460
 
461
461
    def final_file_id(self, trans_id):
1823
1823
                    child_pb.update(gettext('removing file'),
1824
1824
                                    num, total_entries)
1825
1825
                if trans_id == self._new_root:
1826
 
                    file_id = self._tree.get_root_id()
 
1826
                    file_id = self._tree.path2id('')
1827
1827
                else:
1828
1828
                    file_id = self.tree_file_id(trans_id)
1829
1829
                # File-id isn't really being deleted, just moved
2102
2102
        """This Tree does not use inventory as its backing data."""
2103
2103
        raise NotImplementedError(_PreviewTree.root_inventory)
2104
2104
 
2105
 
    def get_root_id(self):
2106
 
        return self._transform.final_file_id(self._transform.root)
2107
 
 
2108
2105
    def all_file_ids(self):
2109
2106
        tree_ids = set(self._transform._tree.all_file_ids())
2110
2107
        tree_ids.difference_update(self._transform.tree_file_id(t)
2288
2285
        else:
2289
2286
            if from_dir is None and include_root is True:
2290
2287
                root_entry = inventory.make_entry(
2291
 
                    'directory', '', ROOT_PARENT, self.get_root_id())
 
2288
                    'directory', '', ROOT_PARENT, self.path2id(''))
2292
2289
                yield '', 'V', 'directory', root_entry
2293
2290
            entries = self._iter_entries_for_dir(from_dir or '')
2294
2291
            for path, entry in entries:
2620
2617
    file_trans_id = {}
2621
2618
    top_pb = ui.ui_factory.nested_progress_bar()
2622
2619
    pp = ProgressPhase("Build phase", 2, top_pb)
2623
 
    if tree.get_root_id() is not None:
 
2620
    if tree.path2id('') is not None:
2624
2621
        # This is kind of a hack: we should be altering the root
2625
2622
        # as part of the regular tree shape diff logic.
2626
2623
        # The conditional test here is to avoid doing an
2628
2625
        # is set within the tree, nor setting the root and thus
2629
2626
        # marking the tree as dirty, because we use two different
2630
2627
        # idioms here: tree interfaces and inventory interfaces.
2631
 
        if wt.get_root_id() != tree.get_root_id():
2632
 
            wt.set_root_id(tree.get_root_id())
 
2628
        if wt.path2id('') != tree.path2id(''):
 
2629
            wt.set_root_id(tree.path2id(''))
2633
2630
            wt.flush()
2634
2631
    tt = wt.get_transform()
2635
2632
    divert = set()
2636
2633
    try:
2637
2634
        pp.next_phase()
2638
 
        file_trans_id[wt.get_root_id()] = tt.trans_id_tree_path('')
 
2635
        file_trans_id[wt.path2id('')] = tt.trans_id_tree_path('')
2639
2636
        with ui.ui_factory.nested_progress_bar() as pb:
2640
2637
            deferred_contents = []
2641
2638
            num = 0