/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 bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-31 05:57:13 UTC
  • mto: (1587.1.6 bound-branches)
  • mto: This revision was merged to the branch mainline in revision 1590.
  • Revision ID: john@arbash-meinel.com-20051231055713-351f8d30e4dc1a8f
Adding tests against an sftp branch.
Fixed a couple of errors it revealed.
Including that we were re-connecting to the master branch
multiple times, inside a write lock (because inside commit
we call pull, which needs the master branch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
517
517
    _lock_count = None
518
518
    _lock = None
519
519
    _inventory_weave = None
 
520
    _master_branch = None
520
521
    
521
522
    # Map some sort of prefix into a namespace
522
523
    # stuff like "revno:10", "revid:", etc.
704
705
            self._lock.unlock()
705
706
            self._lock = None
706
707
            self._lock_mode = self._lock_count = None
 
708
            # TODO: jam 20051230 Consider letting go of the master_branch
707
709
 
708
710
    def abspath(self, name):
709
711
        """See Branch.abspath."""
1045
1047
    @needs_write_lock
1046
1048
    def pull(self, source, overwrite=False):
1047
1049
        """See Branch.pull."""
 
1050
        # TODO: jam 20051230 This does work, in that 'bzr pull'
 
1051
        #       will update the master branch before updating the
 
1052
        #       local branch. However, 'source' can also already
 
1053
        #       be the master branch. Which means that we are
 
1054
        #       asking it to update from itself, before we continue.
 
1055
        #       This probably causes double downloads, etc.
 
1056
        #       So we probably want to put in an explicit check
 
1057
        #       of whether source is already the master branch.
1048
1058
        master_branch = self.get_master_branch()
1049
1059
        if master_branch:
1050
1060
            # TODO: jam 20051230 It would certainly be possible
1052
1062
            #       a little funny about doing it. This should be
1053
1063
            #       discussed.
1054
1064
            if overwrite:
1055
 
                raise errors.OverwriteBoundBranch(branch)
 
1065
                raise errors.OverwriteBoundBranch(self)
1056
1066
            master_branch.pull(source)
1057
1067
            source = master_branch
1058
1068
 
1137
1147
        """
1138
1148
        bound_loc = self.get_bound_location()
1139
1149
        if not bound_loc:
 
1150
            self._master_branch = None
1140
1151
            return None
1141
 
        return Branch.open(bound_loc)
 
1152
        if self._master_branch is None:
 
1153
            self._master_branch = Branch.open(bound_loc)
 
1154
        return self._master_branch
1142
1155
 
1143
1156
    @needs_write_lock
1144
1157
    def set_bound_location(self, location):
 
1158
        """Set the target where this branch is bound to.
 
1159
 
 
1160
        :param location: URL to the target branch
 
1161
        """
 
1162
        self._master_branch = None
1145
1163
        if location:
1146
1164
            self.put_controlfile('bound', location+'\n')
1147
1165
        else: