/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-09-17 04:51:54 UTC
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050917045153-bfa0bd371b0b877e
Most tests pass, some problems with unavailable socket recv

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
     sha_file, appendpath, file_kind
26
26
 
27
27
from bzrlib.errors import BzrError, InvalidRevisionNumber, InvalidRevisionId, \
28
 
     DivergedBranches, NotBranchError
 
28
     DivergedBranches, NotBranchError, NoSuchFile
29
29
from bzrlib.textui import show_status
30
30
from bzrlib.revision import Revision
31
31
from bzrlib.delta import compare_trees
85
85
    Basically we keep looking up until we find the control directory or
86
86
    run into the root.  If there isn't one, raises NotBranchError.
87
87
    """
 
88
    orig_base = t.base
88
89
    while True:
89
90
        if t.has(bzrlib.BZRDIR):
90
91
            return t
91
92
        new_t = t.clone('..')
92
93
        if new_t.base == t.base:
93
94
            # reached the root, whatever that may be
94
 
            raise NotBranchError('%s is not in a branch' % orig_f)
 
95
            raise NotBranchError('%s is not in a branch' % orig_base)
95
96
        t = new_t
96
97
 
97
98
 
116
117
        return LocalBranch(t)
117
118
 
118
119
    @staticmethod
119
 
    def open_containing(url):
 
120
    def open_containing(base):
120
121
        """Open an existing branch, containing url (search upwards for the root)
121
122
        """
122
123
        t = bzrlib.transport.transport(base)
123
 
        found_t = find_branch_root(t)
 
124
        t = find_branch_root(t)
124
125
        return LocalBranch(t)
125
126
 
126
127
    @staticmethod
203
204
        # Alternatively, we could have the Transport objects cache requests
204
205
        # See the earlier discussion about how major objects (like Branch)
205
206
        # should never expect their __del__ function to run.
206
 
        if self.cache_root is not None:
 
207
        if hasattr(self, 'cache_root') and self.cache_root is not None:
207
208
            #from warnings import warn
208
209
            #warn("branch %r auto-cleanup of cache files" % self)
209
210
            try:
376
377
        # This ignores newlines so that we can open branches created
377
378
        # on Windows from Linux and so on.  I think it might be better
378
379
        # to always make all internal files in unix format.
379
 
        fmt = self.controlfile('branch-format', 'r').read()
 
380
        try:
 
381
            fmt = self.controlfile('branch-format', 'r').read()
 
382
        except NoSuchFile:
 
383
            raise NotBranchError('Could not find .bzr/branch-format in %s' 
 
384
                    % self._transport.base)
380
385
        fmt = fmt.replace('\r\n', '\n')
381
386
        if fmt != BZR_BRANCH_FORMAT:
382
387
            raise BzrError('sorry, branch format %r not supported' % fmt,