~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Aaron Bentley
  • Date: 2007-12-21 20:32:22 UTC
  • mto: This revision was merged to the branch mainline in revision 3143.
  • Revision ID: abentley@panoramicfeedback.com-20071221203222-owkqyiye6o5usdwr
Add support for finding branches to BzrDir

Show diffs side-by-side

added added

removed removed

Lines of Context:
286
286
                for subdir in sorted(subdirs, reverse=True):
287
287
                    pending.append(current_transport.clone(subdir))
288
288
 
 
289
    @staticmethod
 
290
    def find_branches(transport):
 
291
        def evaluate(bzrdir):
 
292
            try:
 
293
                repository = bzrdir.open_repository()
 
294
            except errors.NoRepositoryPresent:
 
295
                pass
 
296
            else:
 
297
                return False, (None, repository)
 
298
            try:
 
299
                branch = bzrdir.open_branch()
 
300
            except errors.NotBranchError:
 
301
                return True, (None, None)
 
302
            else:
 
303
                return True, (branch, None)
 
304
        branches = []
 
305
        for branch, repo in BzrDir.find_bzrdirs(transport, evaluate=evaluate):
 
306
            if repo is not None:
 
307
                branches.extend(repo.find_branches())
 
308
            if branch is not None:
 
309
                branches.append(branch)
 
310
        return branches
 
311
 
289
312
 
290
313
    def destroy_repository(self):
291
314
        """Destroy the repository in this BzrDir"""