~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: Martin Pool
  • Date: 2008-05-22 05:48:22 UTC
  • mfrom: (3407.2.16 controlfiles)
  • mto: This revision was merged to the branch mainline in revision 3448.
  • Revision ID: mbp@sourcefrog.net-20080522054822-lrq17tx62wbfzj8r
merge further LockableFile deprecations

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
            # some existing branches where there's a mixture; we probably 
62
62
            # still want the option to look for both.
63
63
            relpath = a_bzrdir._control_files._escape(name)
64
 
            store = TextStore(a_bzrdir._control_files._transport.clone(relpath),
 
64
            store = TextStore(a_bzrdir.transport.clone(relpath),
65
65
                              prefixed=prefixed, compressed=compressed,
66
66
                              dir_mode=dir_mode,
67
67
                              file_mode=file_mode)
74
74
            # which allows access to this old info.
75
75
            self.inventory_store = get_store('inventory-store')
76
76
            text_store = get_store('text-store')
77
 
        super(AllInOneRepository, self).__init__(_format, a_bzrdir, a_bzrdir._control_files, _revision_store, control_store, text_store)
 
77
        super(AllInOneRepository, self).__init__(_format,
 
78
            a_bzrdir, a_bzrdir._control_files, _revision_store, control_store, text_store)
78
79
        if control_store is not None:
79
80
            control_store.get_scope = self.get_transaction
80
81
        text_store.get_scope = self.get_transaction
287
288
        empty_weave = sio.getvalue()
288
289
 
289
290
        mutter('creating repository in %s.', a_bzrdir.transport.base)
290
 
        dirs = ['revision-store', 'weaves']
291
 
        files = [('inventory.weave', StringIO(empty_weave)),
292
 
                 ]
293
291
        
294
292
        # FIXME: RBC 20060125 don't peek under the covers
295
293
        # NB: no need to escape relative paths that are url safe.
296
294
        control_files = lockable_files.LockableFiles(a_bzrdir.transport,
297
 
                                'branch-lock', lockable_files.TransportLock)
 
295
            'branch-lock', lockable_files.TransportLock)
298
296
        control_files.create_lock()
299
297
        control_files.lock_write()
300
 
        a_bzrdir.transport.mkdir_multi(dirs,
301
 
            mode=a_bzrdir._get_dir_mode())
 
298
        transport = a_bzrdir.transport
302
299
        try:
303
 
            for file, content in files:
304
 
                control_files.put(file, content)
 
300
            transport.mkdir_multi(['revision-store', 'weaves'],
 
301
                mode=a_bzrdir._get_dir_mode())
 
302
            transport.put_bytes_non_atomic('inventory.weave', empty_weave)
305
303
        finally:
306
304
            control_files.unlock()
307
305
        return self.open(a_bzrdir, _found=True)