/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 remote.py

Update docs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        Transport.__init__(self, url)
91
91
        (scheme, _, loc, _, _) = urlparse.urlsplit(url)
92
92
        hostport, self._path = urllib.splithost(loc)
93
 
        (self._username, hostport) = urllib.splituser(hostport)
94
93
        (self._host, self._port) = urllib.splitnport(hostport, None)
95
94
        self._client = _client
96
95
 
97
 
    def external_url(self):
98
 
        return self.base
99
 
 
100
96
    def has(self, relpath):
101
97
        return False
102
98
 
103
99
    def _get_client(self):
104
100
        raise NotImplementedError(self._get_client)
105
101
 
106
 
    def _get_path(self):
107
 
        return self._path
108
 
 
109
102
    def fetch_pack(self, determine_wants, graph_walker, pack_data, progress=None):
110
103
        if progress is None:
111
104
            def progress(text):
112
105
                info("git: %s" % text)
113
106
        client = self._get_client()
114
107
        try:
115
 
            return client.fetch_pack(self._get_path(), determine_wants, 
 
108
            return client.fetch_pack(self._path, determine_wants, 
116
109
                graph_walker, pack_data, progress)
117
110
        except GitProtocolError, e:
118
111
            raise BzrError(e)
120
113
    def send_pack(self, get_changed_refs, generate_pack_contents):
121
114
        client = self._get_client()
122
115
        try:
123
 
            return client.send_pack(self._get_path(), get_changed_refs, 
 
116
            return client.send_pack(self._path, get_changed_refs, 
124
117
                generate_pack_contents)
125
118
        except GitProtocolError, e:
126
119
            raise BzrError(e)
158
151
 
159
152
    _scheme = 'git+ssh'
160
153
 
161
 
    def _get_path(self):
162
 
        if self._path.startswith("/~/"):
163
 
            return self._path[3:]
164
 
        return self._path
165
 
 
166
154
    def _get_client(self):
167
155
        if self._client is not None:
168
156
            ret = self._client
169
157
            self._client = None
170
158
            return ret
171
 
        return git.client.SSHGitClient(self._host, self._port, self._username,
172
 
            thin_packs=False, report_activity=self._report_activity)
 
159
        return git.client.SSHGitClient(self._host, self._port, thin_packs=False,
 
160
            report_activity=self._report_activity)
173
161
 
174
162
 
175
163
class RemoteGitDir(GitDir):
208
196
    @property
209
197
    def index(self):
210
198
        if self._idx is None:
 
199
            if self._data is None:
 
200
                self._data = PackData(self._data_path)
211
201
            pb = ui.ui_factory.nested_progress_bar()
212
202
            try:
213
203
                def report_progress(cur, total):
214
204
                    pb.update("generating index", cur, total)
215
 
                self.data.create_index(self._idx_path, self.resolve_ext_ref,
 
205
                self._data.create_index_v2(self._idx_path, self.resolve_ext_ref,
216
206
                    progress=report_progress)
217
207
            finally:
218
208
                pb.finished()
302
292
 
303
293
    @property
304
294
    def head(self):
305
 
        if self._ref is not None:
 
295
        if self._ref is None:
306
296
            return self._ref
307
 
        heads = self.repository.get_refs()
308
 
        if not self.name in heads:
 
297
        heads = repository.get_refs()
 
298
        if not name in heads:
309
299
            raise NoSuchRef(name)
310
 
        self._ref = heads[self.name]
 
300
        self._ref = heads[name]
311
301
        return self._ref
312
302
 
313
303
    def _synchronize_history(self, destination, revision_id):
314
304
        """See Branch._synchronize_history()."""
315
305
        destination.generate_revision_history(self.last_revision())
316
306
 
317
 
    def get_push_location(self):
318
 
        return None
319
 
 
320
 
    def set_push_location(self, url):
321
 
        pass