~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-01 00:36:13 UTC
  • mfrom: (2692.1.26 bug-124089)
  • Revision ID: pqm@pqm.ubuntu.com-20080401003613-w51tu4gd3yqogm8s
Add root_client_path parameter to SmartWSGIApp and
        SmartServerRequest. (Andrew Bennetts, #124089)

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    def do(self, path, *args):
42
42
        """Execute a repository request.
43
43
        
44
 
        The repository must be at the exact path - no searching is done.
 
44
        All Repository requests take a path to the repository as their first
 
45
        argument.  The repository must be at the exact path given by the
 
46
        client - no searching is done.
45
47
 
46
48
        The actual logic is delegated to self.do_repository_request.
47
49
 
48
 
        :param path: The path for the repository.
49
 
        :return: A smart server from self.do_repository_request().
 
50
        :param client_path: The path for the repository as received from the
 
51
            client.
 
52
        :return: A SmartServerResponse from self.do_repository_request().
50
53
        """
51
 
        transport = self._backing_transport.clone(path)
 
54
        transport = self.transport_from_client_path(path)
52
55
        bzrdir = BzrDir.open_from_transport(transport)
53
56
        # Save the repository for use with do_body.
54
57
        self._repository = bzrdir.open_repository()
446
449
        pack = ContainerSerialiser()
447
450
        yield pack.begin()
448
451
        try:
449
 
            for name_tuple, bytes in stream:
450
 
                yield pack.bytes_record(bytes, [name_tuple])
 
452
            try:
 
453
                for name_tuple, bytes in stream:
 
454
                    yield pack.bytes_record(bytes, [name_tuple])
 
455
            except:
 
456
                # Undo the lock_read that that happens once the iterator from
 
457
                # get_data_stream is started.
 
458
                repository.unlock()
 
459
                raise
451
460
        except errors.RevisionNotPresent, e:
452
461
            # This shouldn't be able to happen, but as we don't buffer
453
462
            # everything it can in theory happen.
 
463
            repository.unlock()
454
464
            yield FailedSmartServerResponse(('NoSuchRevision', e.revision_id))
455
 
        repository.unlock()
456
 
        pack.end()
 
465
        else:
 
466
            repository.unlock()
 
467
            pack.end()
457
468