~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

  • Committer: Robert Collins
  • Date: 2008-09-19 06:53:41 UTC
  • mto: (3696.5.1 commit-updates)
  • mto: This revision was merged to the branch mainline in revision 3741.
  • Revision ID: robertc@robertcollins.net-20080919065341-5t5w1p2gi926nfia
First cut - make it work - at updating the tree stat cache during commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Server-side repository related request implmentations."""
18
18
 
19
19
import bz2
20
 
from cStringIO import StringIO
21
20
import os
22
21
import sys
23
22
import tempfile
24
23
import tarfile
25
24
 
26
 
from bzrlib import errors
 
25
from bzrlib import (
 
26
    errors,
 
27
    osutils,
 
28
    )
27
29
from bzrlib.bzrdir import BzrDir
28
 
from bzrlib.pack import ContainerSerialiser
29
30
from bzrlib.smart.request import (
30
31
    FailedSmartServerResponse,
31
32
    SmartServerRequest,
348
349
    """
349
350
 
350
351
    def do_repository_request(self, repository, compression):
351
 
        from bzrlib import osutils
352
352
        tmp_dirname, tmp_repo = self._copy_to_tempdir(repository)
353
353
        try:
354
354
            controldir_name = tmp_dirname + '/.bzr'
357
357
            osutils.rmtree(tmp_dirname)
358
358
 
359
359
    def _copy_to_tempdir(self, from_repo):
360
 
        tmp_dirname = tempfile.mkdtemp(prefix='tmpbzrclone')
 
360
        tmp_dirname = osutils.mkdtemp(prefix='tmpbzrclone')
361
361
        tmp_bzrdir = from_repo.bzrdir._format.initialize(tmp_dirname)
362
362
        tmp_repo = from_repo._format.initialize(tmp_bzrdir)
363
363
        from_repo.copy_content_into(tmp_repo)
370
370
            # all finished; write the tempfile out to the network
371
371
            temp.seek(0)
372
372
            return SuccessfulSmartServerResponse(('ok',), temp.read())
373
 
            # FIXME: Don't read the whole thing into memory here; rather stream it
374
 
            # out from the file onto the network. mbp 20070411
 
373
            # FIXME: Don't read the whole thing into memory here; rather stream
 
374
            # it out from the file onto the network. mbp 20070411
375
375
        finally:
376
376
            temp.close()
377
377