/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/plugins/fastimport/branch_updater.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        # already put the 'trunk' first, do it now.
89
89
        git_to_bzr_map = {}
90
90
        for ref_name in ref_names:
91
 
            git_to_bzr_map[ref_name] = self.cache_mgr.branch_mapper.git_to_bzr(ref_name)
 
91
            git_to_bzr_map[ref_name] = self.cache_mgr.branch_mapper.git_to_bzr(
 
92
                ref_name)
92
93
        if ref_names and self.branch is None:
93
94
            trunk = self.select_trunk(ref_names)
94
95
            git_bzr_items = [(trunk, git_to_bzr_map[trunk])]
102
103
            # Using the Bazaar name, get a directory under the current one
103
104
            repo_base = self.repo.controldir.transport.base
104
105
            return osutils.pathjoin(repo_base, "..", name)
 
106
 
105
107
        def dir_sister_branch(name):
106
108
            # Using the Bazaar name, get a sister directory to the branch
107
109
            return osutils.pathjoin(self.branch.base, "..", name)
112
114
 
113
115
        # Create/track missing branches
114
116
        can_create_branches = (
115
 
                self.repo.is_shared() or
116
 
                self.repo.controldir._format.colocated_branches)
 
117
            self.repo.is_shared() or
 
118
            self.repo.controldir._format.colocated_branches)
117
119
        for ref_name, name in git_bzr_items:
118
120
            tip = self.heads_by_ref[ref_name][0]
119
121
            if can_create_branches:
123
125
                    continue
124
126
                except errors.BzrError as ex:
125
127
                    show_error("ERROR: failed to create branch %s: %s",
126
 
                        name, ex)
 
128
                               name, ex)
127
129
            lost_head = self.cache_mgr.lookup_committish(tip)
128
130
            lost_info = (name, lost_head)
129
131
            lost_heads.append(lost_info)
156
158
            except errors.NotBranchError as ex:
157
159
                return self.repo.controldir.create_branch(name)
158
160
 
159
 
 
160
161
    def _update_branch(self, br, last_mark):
161
162
        """Update a branch with last revision and tag information.
162
163
 
175
176
        my_tags = {}
176
177
        if self.tags:
177
178
            graph = self.repo.get_graph()
178
 
            ancestry = [r for (r, ps) in graph.iter_ancestry([last_rev_id]) if ps is not None]
 
179
            ancestry = [r for (r, ps) in graph.iter_ancestry(
 
180
                [last_rev_id]) if ps is not None]
179
181
            for tag, rev in self.tags.items():
180
182
                if rev in ancestry:
181
183
                    my_tags[tag] = rev
185
187
        if changed:
186
188
            tagno = len(my_tags)
187
189
            note("\t branch %s now has %d %s and %d %s", br.nick,
188
 
                revno, single_plural(revno, "revision", "revisions"),
189
 
                tagno, single_plural(tagno, "tag", "tags"))
 
190
                 revno, single_plural(revno, "revision", "revisions"),
 
191
                 tagno, single_plural(tagno, "tag", "tags"))
190
192
        return changed