~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Andrew Bennetts
  • Date: 2011-03-23 05:15:48 UTC
  • mfrom: (5609.24.5 2.3)
  • mto: This revision was merged to the branch mainline in revision 5732.
  • Revision ID: andrew.bennetts@canonical.com-20110323051548-rit3h3i274gszs2n
Merge lp:bzr/2.3, including fixes for #465517 and #733350.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
    :ivar base:
80
80
        Base directory/url of the branch; using control_url and
81
81
        control_transport is more standardized.
82
 
 
83
 
    hooks: An instance of BranchHooks.
 
82
    :ivar hooks: An instance of BranchHooks.
 
83
    :ivar _master_branch_cache: cached result of get_master_branch, see
 
84
        _clear_cached_state.
84
85
    """
85
86
    # this is really an instance variable - FIXME move it there
86
87
    # - RBC 20060112
102
103
        self._partial_revision_history_cache = []
103
104
        self._tags_bytes = None
104
105
        self._last_revision_info_cache = None
 
106
        self._master_branch_cache = None
105
107
        self._merge_sorted_revisions_cache = None
106
108
        self._open_hook()
107
109
        hooks = Branch.hooks['open']
937
939
        self._revision_history_cache = None
938
940
        self._revision_id_to_revno_cache = None
939
941
        self._last_revision_info_cache = None
 
942
        self._master_branch_cache = None
940
943
        self._merge_sorted_revisions_cache = None
941
944
        self._partial_revision_history_cache = []
942
945
        self._partial_revision_id_to_revno_cache = {}
2637
2640
            target.update_revisions(self, stop_revision,
2638
2641
                overwrite=overwrite, graph=graph)
2639
2642
        if self._push_should_merge_tags():
2640
 
            result.tag_conflicts = self.tags.merge_to(target.tags,
2641
 
                overwrite)
 
2643
            result.tag_conflicts = self.tags.merge_to(target.tags, overwrite)
2642
2644
        result.new_revno, result.new_revid = target.last_revision_info()
2643
2645
        return result
2644
2646
 
2676
2678
        """Return the branch we are bound to.
2677
2679
 
2678
2680
        :return: Either a Branch, or None
2679
 
 
2680
 
        This could memoise the branch, but if thats done
2681
 
        it must be revalidated on each new lock.
2682
 
        So for now we just don't memoise it.
2683
 
        # RBC 20060304 review this decision.
2684
2681
        """
 
2682
        if self._master_branch_cache is None:
 
2683
            self._master_branch_cache = self._get_master_branch(
 
2684
                possible_transports)
 
2685
        return self._master_branch_cache
 
2686
 
 
2687
    def _get_master_branch(self, possible_transports):
2685
2688
        bound_loc = self.get_bound_location()
2686
2689
        if not bound_loc:
2687
2690
            return None
2698
2701
 
2699
2702
        :param location: URL to the target branch
2700
2703
        """
 
2704
        self._master_branch_cache = None
2701
2705
        if location:
2702
2706
            self._transport.put_bytes('bound', location+'\n',
2703
2707
                mode=self.bzrdir._get_file_mode())
2955
2959
 
2956
2960
    def set_bound_location(self, location):
2957
2961
        """See Branch.set_push_location."""
 
2962
        self._master_branch_cache = None
2958
2963
        result = None
2959
2964
        config = self.get_config()
2960
2965
        if location is None: