/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 processors/generic_processor.py

always use heads/master as the trunk if it is present

Show diffs side-by-side

added added

removed removed

Lines of Context:
687
687
        lost_heads = []
688
688
        ref_names = self.heads_by_ref.keys()
689
689
        if self.branch is not None:
690
 
            # Until there's a good reason to be more selective,
691
 
            # use the last imported revision as the tip of the default branch
692
 
            default_tip = self.heads_by_ref[self.last_ref][0]
 
690
            trunk = self.select_trunk(ref_names)
 
691
            default_tip = self.heads_by_ref[trunk][0]
693
692
            branch_tips.append((self.branch, default_tip))
694
 
            ref_names.remove(self.last_ref)
 
693
            ref_names.remove(trunk)
695
694
 
696
695
        # Convert the reference names into Bazaar speak
697
696
        bzr_names = self._get_bzr_names_from_ref_names(ref_names)
727
726
            lost_heads.append(lost_info)
728
727
        return branch_tips, lost_heads
729
728
 
 
729
    def select_trunk(self, ref_names):
 
730
        """Given a set of ref names, choose one as the trunk."""
 
731
        for candidate in ['refs/heads/master']:
 
732
            if candidate in ref_names:
 
733
                return candidate
 
734
        # Use the last reference in the import stream
 
735
        return self.last_ref
 
736
 
730
737
    def make_branch(self, location):
731
738
        """Create a branch in the repository."""
732
739
        return bzrdir.BzrDir.create_branch_convenience(location)