~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-02-17 15:50:09 UTC
  • mfrom: (5042 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5043.
  • Revision ID: jelmer@samba.org-20100217155009-ok2wijesnvly49sg
merge devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
355
355
                for subdir in sorted(subdirs, reverse=True):
356
356
                    pending.append(current_transport.clone(subdir))
357
357
 
 
358
    def list_branches(self):
 
359
        """Return a sequence of all branches local to this control directory.
 
360
 
 
361
        """
 
362
        try:
 
363
            return [self.open_branch()]
 
364
        except errors.NotBranchError:
 
365
            return []
 
366
 
358
367
    @staticmethod
359
368
    def find_branches(transport):
360
369
        """Find all branches under a transport.
372
381
            except errors.NoRepositoryPresent:
373
382
                pass
374
383
            else:
375
 
                return False, (None, repository)
376
 
            try:
377
 
                branch = bzrdir.open_branch()
378
 
            except errors.NotBranchError:
379
 
                return True, (None, None)
380
 
            else:
381
 
                return True, (branch, None)
382
 
        branches = []
383
 
        for branch, repo in BzrDir.find_bzrdirs(transport, evaluate=evaluate):
 
384
                return False, ([], repository)
 
385
            return True, (bzrdir.list_branches(), None)
 
386
        ret = []
 
387
        for branches, repo in BzrDir.find_bzrdirs(transport,
 
388
                                                  evaluate=evaluate):
384
389
            if repo is not None:
385
 
                branches.extend(repo.find_branches())
386
 
            if branch is not None:
387
 
                branches.append(branch)
388
 
        return branches
 
390
                ret.extend(repo.find_branches())
 
391
            if branches is not None:
 
392
                ret.extend(branches)
 
393
        return ret
389
394
 
390
395
    def destroy_repository(self):
391
396
        """Destroy the repository in this BzrDir"""
3054
3059
                ui.ui_factory.note('starting repository conversion')
3055
3060
                converter = CopyConverter(self.target_format.repository_format)
3056
3061
                converter.convert(repo, pb)
3057
 
        try:
3058
 
            branch = self.bzrdir.open_branch()
3059
 
        except errors.NotBranchError:
3060
 
            pass
3061
 
        else:
 
3062
        for branch in self.bzrdir.list_branches():
3062
3063
            # TODO: conversions of Branch and Tree should be done by
3063
3064
            # InterXFormat lookups/some sort of registry.
3064
3065
            # Avoid circular imports