~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-16 08:51:31 UTC
  • Revision ID: mbp@sourcefrog.net-20050916085131-9b4838e342407af0
- refactor branch version detection

Show diffs side-by-side

added added

removed removed

Lines of Context:
348
348
        fmt = self.controlfile('branch-format', 'r').read()
349
349
        if fmt == BZR_BRANCH_FORMAT_5:
350
350
            self._branch_format = 5
351
 
            return
352
 
        elif relax_version_check:
353
 
            if fmt == BZR_BRANCH_FORMAT_4:
354
 
                self._branch_format = 4
355
 
                return
356
 
            
357
 
        raise BzrError('sorry, branch format "%s" not supported; ' 
358
 
                       'use a different bzr version, '
359
 
                       'or run "bzr upgrade"'
360
 
                       % fmt.rstrip('\n\r'))
 
351
        elif fmt == BZR_BRANCH_FORMAT_4:
 
352
            self._branch_format = 4
 
353
 
 
354
        if (not relax_version_check
 
355
            and self._branch_format != 5):
 
356
            raise BzrError('sorry, branch format "%s" not supported; ' 
 
357
                           'use a different bzr version, '
 
358
                           'or run "bzr upgrade"'
 
359
                           % fmt.rstrip('\n\r'))
361
360
        
362
361
 
363
362
    def get_root_id(self):