~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-18 17:13:34 UTC
  • mto: (1185.11.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050718171333-52cdbb6c84ba1044
Created mkdir_multi, modified branch to use _multi forms when initializing a branch, creating a full test routine for transports

Show diffs side-by-side

added added

removed removed

Lines of Context:
317
317
        from bzrlib.xml import pack_xml
318
318
        from cStringIO import StringIO
319
319
        
320
 
        self._transport.mkdir(self._rel_controlfilename([]))
321
 
        self._transport.put(self._rel_controlfilename('README'),
 
320
        # Create an empty inventory to store
 
321
        sio = StringIO()
 
322
        pack_xml(Inventory(), sio)
 
323
 
 
324
        dirs = [[], 'text-store', 'inventory-store', 'revision-store']
 
325
        files = [('README', 
322
326
            "This is a Bazaar-NG control directory.\n"
323
 
            "Do not change any files in this directory.\n")
324
 
        self._transport.put(self._rel_controlfilename('branch-format'),
325
 
            BZR_BRANCH_FORMAT)
326
 
        for d in ('text-store', 'inventory-store', 'revision-store'):
327
 
            self._transport.mkdir(self._rel_controlfilename(d))
328
 
        for f in ('revision-history', 'merged-patches',
329
 
                  'pending-merged-patches', 'branch-name',
330
 
                  'branch-lock',
331
 
                  'pending-merges'):
332
 
            self._transport.put(self._rel_controlfilename(f), '')
 
327
            "Do not change any files in this directory.\n"),
 
328
            ('branch-format', BZR_BRANCH_FORMAT),
 
329
            ('revision-history', ''),
 
330
            ('merged-patches', ''),
 
331
            ('pending-merged-patches', ''),
 
332
            ('branch-name', ''),
 
333
            ('branch-lock', ''),
 
334
            ('pending-merges', ''),
 
335
            ('inventory', sio.getvalue())
 
336
        ]
 
337
        self._transport.mkdir_multi([self._rel_controlfilename(d) for d in dirs])
 
338
        self._transport.put_multi([(self._rel_controlfilename(f[0]),f[1]) for f in files])
333
339
        mutter('created control directory in ' + self._transport.base)
334
340
 
335
 
        # TODO: Try and do this with self._transport.put() instead
336
 
        sio = StringIO()
337
 
        pack_xml(Inventory(), sio)
338
 
        sio.seek(0)
339
 
        self.put_controlfile('inventory', sio, encode=False)
340
 
 
341
 
 
342
341
    def _check_format(self):
343
342
        """Check this branch format is supported.
344
343