/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

Set refs/heads/master if no ref is set yet.

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):
342
333
class RemoteGitBranch(GitBranch):
343
334
 
344
335
    def __init__(self, bzrdir, repository, name, lockfiles):
345
 
        self._sha = None
 
336
        self._ref = None
346
337
        super(RemoteGitBranch, self).__init__(bzrdir, repository, name,
347
338
                lockfiles)
348
339
 
362
353
 
363
354
    @property
364
355
    def head(self):
365
 
        if self._sha is not None:
366
 
            return self._sha
 
356
        if self._ref is not None:
 
357
            return self._ref
367
358
        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]
 
359
        if self.name in heads:
 
360
            self._ref = heads[self.name]
 
361
        elif ("refs/heads/" + self.name) in heads:
 
362
            self._ref = heads["refs/heads/" + self.name]
371
363
        else:
372
364
            raise NoSuchRef(self.name)
373
 
        return self._sha
 
365
        return self._ref
374
366
 
375
367
    def _synchronize_history(self, destination, revision_id):
376
368
        """See Branch._synchronize_history()."""