/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 copyright years

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Jelmer Vernooij <jelmer@samba.org>
 
1
# Copyright (C) 2007-2009 Jelmer Vernooij <jelmer@samba.org>
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
182
182
            ret = self._client
183
183
            self._client = None
184
184
            return ret
185
 
        location_config = config.LocationConfig(self.base)
186
 
        client = git.client.SSHGitClient(self._host, self._port, self._username,
 
185
        return git.client.SSHGitClient(self._host, self._port, self._username,
187
186
            thin_packs=thin_packs, report_activity=self._report_activity)
188
 
        # Set up alternate pack program paths
189
 
        upload_pack = location_config.get_user_option('git_upload_pack')
190
 
        if upload_pack:
191
 
            client.alternative_paths["upload-pack"] = upload_pack
192
 
        receive_pack = location_config.get_user_option('git_receive_pack')
193
 
        if receive_pack:
194
 
            client.alternative_paths["receive-pack"] = receive_pack
195
 
        return client
196
187
 
197
188
 
198
189
class RemoteGitDir(GitDir):
204
195
        self._lockfiles = lockfiles
205
196
        self._mode_check_done = None
206
197
 
207
 
    def _branch_name_to_ref(self, name, default=None):
208
 
        return branch_name_to_ref(name, default=default)
 
198
    def _branch_name_to_ref(self, name):
 
199
        return branch_name_to_ref(name, default="HEAD")
209
200
 
210
201
    def open_repository(self):
211
202
        return RemoteGitRepository(self, self._lockfiles)
312
303
        except InvalidRevisionId:
313
304
            raise NoSuchRevision(self, bzr_revid)
314
305
 
315
 
    def lookup_foreign_revision_id(self, foreign_revid, mapping=None):
316
 
        """Lookup a revision id.
317
 
 
318
 
        """
319
 
        if mapping is None:
320
 
            mapping = self.get_mapping()
321
 
        # Not really an easy way to parse foreign revids here..
322
 
        return mapping.revision_id_foreign_to_bzr(foreign_revid)
323
 
 
324
306
 
325
307
class RemoteGitTagDict(tag.BasicTags):
326
308
 
342
324
class RemoteGitBranch(GitBranch):
343
325
 
344
326
    def __init__(self, bzrdir, repository, name, lockfiles):
345
 
        self._sha = None
 
327
        self._ref = None
346
328
        super(RemoteGitBranch, self).__init__(bzrdir, repository, name,
347
329
                lockfiles)
348
330
 
350
332
        raise GitSmartRemoteNotSupported()
351
333
 
352
334
    def last_revision(self):
353
 
        return self.lookup_foreign_revision_id(self.head)
 
335
        return self.mapping.revision_id_foreign_to_bzr(self.head)
354
336
 
355
337
    def _get_config(self):
356
338
        class EmptyConfig(object):
362
344
 
363
345
    @property
364
346
    def head(self):
365
 
        if self._sha is not None:
366
 
            return self._sha
 
347
        if self._ref is not None:
 
348
            return self._ref
367
349
        heads = self.repository.get_refs()
368
 
        name = self.bzrdir._branch_name_to_ref(self.name, "HEAD")
369
 
        if name in heads:
370
 
            self._sha = heads[name]
 
350
        if self.name in heads:
 
351
            self._ref = heads[self.name]
 
352
        elif ("refs/heads/" + self.name) in heads:
 
353
            self._ref = heads["refs/heads/" + self.name]
371
354
        else:
372
355
            raise NoSuchRef(self.name)
373
 
        return self._sha
 
356
        return self._ref
374
357
 
375
358
    def _synchronize_history(self, destination, revision_id):
376
359
        """See Branch._synchronize_history()."""