/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

Merge VersionedFiles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
736
736
        self._ensure_real()
737
737
        return self._real_repository.get_revision(revision_id)
738
738
 
739
 
    @property
740
 
    def weave_store(self):
741
 
        self._ensure_real()
742
 
        return self._real_repository.weave_store
743
 
 
744
739
    def get_transaction(self):
745
740
        self._ensure_real()
746
741
        return self._real_repository.get_transaction()
795
790
        self._ensure_real()
796
791
        self._real_repository.create_bundle(target, base, fileobj, format)
797
792
 
798
 
    @property
799
 
    def control_weaves(self):
800
 
        self._ensure_real()
801
 
        return self._real_repository.control_weaves
802
 
 
803
793
    @needs_read_lock
804
794
    def get_ancestry(self, revision_id, topo_sorted=True):
805
795
        self._ensure_real()
806
796
        return self._real_repository.get_ancestry(revision_id, topo_sorted)
807
797
 
808
 
    @needs_read_lock
809
 
    def get_inventory_weave(self):
 
798
    @property
 
799
    def inventories(self):
810
800
        self._ensure_real()
811
 
        return self._real_repository.get_inventory_weave()
 
801
        return self._real_repository.inventories
812
802
 
813
803
    def fileids_altered_by_revision_ids(self, revision_ids):
814
804
        self._ensure_real()
1042
1032
        # TODO: Suggestion from john: using external tar is much faster than
1043
1033
        # python's tarfile library, but it may not work on windows.
1044
1034
 
 
1035
    @property
 
1036
    def inventories(self):
 
1037
        """Decorate the real repository for now.
 
1038
 
 
1039
        In the long term a full blown network facility is needed to
 
1040
        avoid creating a real repository object locally.
 
1041
        """
 
1042
        self._ensure_real()
 
1043
        return self._real_repository.inventories
 
1044
 
1045
1045
    @needs_write_lock
1046
1046
    def pack(self):
1047
1047
        """Compress the data within the repository.
1051
1051
        self._ensure_real()
1052
1052
        return self._real_repository.pack()
1053
1053
 
 
1054
    @property
 
1055
    def revisions(self):
 
1056
        """Decorate the real repository for now.
 
1057
 
 
1058
        In the short term this should become a real object to intercept graph
 
1059
        lookups.
 
1060
 
 
1061
        In the long term a full blown network facility is needed.
 
1062
        """
 
1063
        self._ensure_real()
 
1064
        return self._real_repository.revisions
 
1065
 
1054
1066
    def set_make_working_trees(self, new_value):
1055
1067
        self._ensure_real()
1056
1068
        self._real_repository.set_make_working_trees(new_value)
1057
1069
 
 
1070
    @property
 
1071
    def signatures(self):
 
1072
        """Decorate the real repository for now.
 
1073
 
 
1074
        In the long term a full blown network facility is needed to avoid
 
1075
        creating a real repository object locally.
 
1076
        """
 
1077
        self._ensure_real()
 
1078
        return self._real_repository.signatures
 
1079
 
1058
1080
    @needs_write_lock
1059
1081
    def sign_revision(self, revision_id, gpg_strategy):
1060
1082
        self._ensure_real()
1061
1083
        return self._real_repository.sign_revision(revision_id, gpg_strategy)
1062
1084
 
 
1085
    @property
 
1086
    def texts(self):
 
1087
        """Decorate the real repository for now.
 
1088
 
 
1089
        In the long term a full blown network facility is needed to avoid
 
1090
        creating a real repository object locally.
 
1091
        """
 
1092
        self._ensure_real()
 
1093
        return self._real_repository.texts
 
1094
 
1063
1095
    @needs_read_lock
1064
1096
    def get_revisions(self, revision_ids):
1065
1097
        self._ensure_real()
1091
1123
        self._ensure_real()
1092
1124
        return self._real_repository.has_signature_for_revision_id(revision_id)
1093
1125
 
1094
 
    def get_data_stream_for_search(self, search):
1095
 
        medium = self._client._medium
1096
 
        if not medium._remote_is_at_least_1_2:
1097
 
            self._ensure_real()
1098
 
            return self._real_repository.get_data_stream_for_search(search)
1099
 
        REQUEST_NAME = 'Repository.stream_revisions_chunked'
1100
 
        path = self.bzrdir._path_for_remote_call(self._client)
1101
 
        body = self._serialise_search_recipe(search.get_recipe())
1102
 
        try:
1103
 
            result = self._client.call_with_body_bytes_expecting_body(
1104
 
                REQUEST_NAME, (path,), body)
1105
 
            response, protocol = result
1106
 
        except errors.UnknownSmartMethod:
1107
 
            # Server does not support this method, so fall back to VFS.
1108
 
            # Worse, we have to force a disconnection, because the server now
1109
 
            # doesn't realise it has a body on the wire to consume, so the
1110
 
            # only way to recover is to abandon the connection.
1111
 
            warning(
1112
 
                'Server is too old for streaming pull, reconnecting.  '
1113
 
                '(Upgrade the server to Bazaar 1.2 to avoid this)')
1114
 
            medium.disconnect()
1115
 
            # To avoid having to disconnect repeatedly, we keep track of the
1116
 
            # fact the server doesn't understand this remote method.
1117
 
            medium._remote_is_at_least_1_2 = False
1118
 
            self._ensure_real()
1119
 
            return self._real_repository.get_data_stream_for_search(search)
1120
 
 
1121
 
        if response == ('ok',):
1122
 
            return self._deserialise_stream(protocol)
1123
 
        if response == ('NoSuchRevision', ):
1124
 
            # We cannot easily identify the revision that is missing in this
1125
 
            # situation without doing much more network IO. For now, bail.
1126
 
            raise NoSuchRevision(self, "unknown")
1127
 
        else:
1128
 
            raise errors.UnexpectedSmartServerResponse(response)
1129
 
 
1130
 
    def _deserialise_stream(self, protocol):
1131
 
        stream = protocol.read_streamed_body()
1132
 
        container_parser = ContainerPushParser()
1133
 
        for bytes in stream:
1134
 
            container_parser.accept_bytes(bytes)
1135
 
            records = container_parser.read_pending_records()
1136
 
            for record_names, record_bytes in records:
1137
 
                if len(record_names) != 1:
1138
 
                    # These records should have only one name, and that name
1139
 
                    # should be a one-element tuple.
1140
 
                    raise errors.SmartProtocolError(
1141
 
                        'Repository data stream had invalid record name %r'
1142
 
                        % (record_names,))
1143
 
                name_tuple = record_names[0]
1144
 
                yield name_tuple, record_bytes
1145
 
 
1146
 
    def insert_data_stream(self, stream):
1147
 
        self._ensure_real()
1148
 
        self._real_repository.insert_data_stream(stream)
1149
 
 
1150
1126
    def item_keys_introduced_by(self, revision_ids, _files_pb=None):
1151
1127
        self._ensure_real()
1152
1128
        return self._real_repository.item_keys_introduced_by(revision_ids,