~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Martin Pool
  • Date: 2007-04-11 10:07:02 UTC
  • mto: (2420.2.2 bzr.http.auth)
  • mto: This revision was merged to the branch mainline in revision 2462.
  • Revision ID: mbp@sourcefrog.net-20070411100702-r12ixsycxcohqu4s
copy_content_into from Remote repositories by using temporary directories on both ends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
576
576
        return self._real_repository.check(revision_ids)
577
577
 
578
578
    def copy_content_into(self, destination, revision_id=None, basis=None):
 
579
        # get a tarball of the remote repository, and copy from that into the
 
580
        # destination
 
581
        from bzrlib import osutils
579
582
        import tarfile
 
583
        import tempfile
580
584
        from StringIO import StringIO
581
 
        tempfile = StringIO(self._get_tarball('bz2'))
582
 
        tar = tarfile.open('repository', fileobj=tempfile,
 
585
        tar_file = StringIO(self._get_tarball('bz2'))
 
586
        tar = tarfile.open('repository', fileobj=tar_file,
583
587
            mode='r:bz2')
584
 
        import pdb;pdb.set_trace()
585
 
        self._ensure_real()
586
 
        return self._real_repository.copy_content_into(
587
 
            destination, revision_id=revision_id, basis=basis)
 
588
        tmpdir = tempfile.mkdtemp()
 
589
        try:
 
590
            tar.extractall(tmpdir)
 
591
            tmp_repo = repository.Repository.open(tmpdir)
 
592
            tmp_repo.copy_content_into(destination, revision_id, basis)
 
593
        finally:
 
594
            pass
 
595
            ##            osutils.rmtree(tmpdir)
 
596
        # TODO: if the server doesn't support this operation, maybe do it the
 
597
        # slow way using the _real_repository?
588
598
 
589
599
    def set_make_working_trees(self, new_value):
590
600
        raise NotImplementedError(self.set_make_working_trees)