/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: Martin Pool
  • Date: 2005-09-06 07:32:07 UTC
  • Revision ID: mbp@sourcefrog.net-20050906073206-aaa7bcb6dbbe7e38
- start implementing v5 format; Branch refuses to operate on old branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
 
37
37
 
38
 
BZR_BRANCH_FORMAT = "Bazaar-NG branch, format 0.0.4\n"
 
38
BZR_BRANCH_FORMAT_4 = "Bazaar-NG branch, format 0.0.4\n"
 
39
BZR_BRANCH_FORMAT_5 = "Bazaar-NG branch, format 5\n"
39
40
## TODO: Maybe include checks for common corruption of newlines, etc?
40
41
 
41
42
 
307
308
        self.controlfile('README', 'w').write(
308
309
            "This is a Bazaar-NG control directory.\n"
309
310
            "Do not change any files in this directory.\n")
310
 
        self.controlfile('branch-format', 'w').write(BZR_BRANCH_FORMAT)
 
311
        self.controlfile('branch-format', 'w').write(BZR_BRANCH_FORMAT_5)
311
312
        for d in ('text-store', 'inventory-store', 'revision-store'):
312
313
            os.mkdir(self.controlfilename(d))
313
314
        for f in ('revision-history', 'merged-patches',
335
336
        # This ignores newlines so that we can open branches created
336
337
        # on Windows from Linux and so on.  I think it might be better
337
338
        # to always make all internal files in unix format.
338
 
        fmt = self.controlfile('branch-format', 'r').read()
339
 
        fmt.replace('\r\n', '')
340
 
        if fmt != BZR_BRANCH_FORMAT:
341
 
            raise BzrError('sorry, branch format %r not supported' % fmt,
342
 
                           ['use a different bzr version',
343
 
                            'or remove the .bzr directory and "bzr init" again'])
 
339
        fmt = self.controlfile('branch-format', 'r').read().rstrip('\r\n')
 
340
        if fmt != BZR_BRANCH_FORMAT_5:
 
341
            raise BzrError('sorry, branch format "%s" not supported; ' 
 
342
                           'use a different bzr version, '
 
343
                           'or run "bzr upgrade", '
 
344
                           'or remove the .bzr directory and "bzr init" again'
 
345
                           % fmt)
344
346
 
345
347
    def get_root_id(self):
346
348
        """Return the id of this branches root"""