476
479
refname = self._get_selected_ref(name)
478
481
def get_changed_refs(old_refs):
480
if refname not in ret:
483
if refname not in old_refs:
481
484
raise NotBranchError(self.user_url)
482
485
ret[refname] = dulwich.client.ZERO_SHA
566
569
if isinstance(source, GitBranch) and lossy:
567
570
raise errors.LossyPushToSameVCS(source.controldir, self)
568
571
source_store = get_object_store(source.repository)
572
fetch_tags = source.get_config_stack().get('branch.fetch_tags')
573
def get_changed_refs(refs):
574
self._refs = remote_refs_dict_to_container(refs)
576
# TODO(jelmer): Unpeel if necessary
577
push_result.new_original_revid = revision_id
579
new_sha = source_store._lookup_revision_sha1(revision_id)
582
new_sha = repo.lookup_bzr_revision_id(revision_id)[0]
583
except errors.NoSuchRevision:
584
raise errors.NoRoundtrippingSupport(
585
source, self.open_branch(name=name, nascent_ok=True))
587
if remote_divergence(ret.get(refname), new_sha,
589
raise DivergedBranches(
590
source, self.open_branch(name, nascent_ok=True))
591
ret[refname] = new_sha
593
for tagname, revid in viewitems(source.tags.get_tag_dict()):
595
new_sha = source_store._lookup_revision_sha1(revid)
598
new_sha = repo.lookup_bzr_revision_id(revid)[0]
599
except errors.NoSuchRevision:
601
ret[tag_name_to_ref(tagname)] = new_sha
569
603
with source_store.lock_read():
570
def get_changed_refs(refs):
571
self._refs = remote_refs_dict_to_container(refs)
573
# TODO(jelmer): Unpeel if necessary
574
push_result.new_original_revid = revision_id
576
new_sha = source_store._lookup_revision_sha1(revision_id)
579
new_sha = repo.lookup_bzr_revision_id(revision_id)[0]
580
except errors.NoSuchRevision:
581
raise errors.NoRoundtrippingSupport(
582
source, self.open_branch(name=name, nascent_ok=True))
584
if remote_divergence(ret.get(refname), new_sha,
586
raise DivergedBranches(
587
source, self.open_branch(name, nascent_ok=True))
588
ret[refname] = new_sha
591
605
generate_pack_data = source_store.generate_lossy_pack_data
661
675
def __init__(self, transport, *args, **kwargs):
662
676
self.transport = transport
663
super(BzrGitHttpClient, self).__init__(
664
transport.external_url(), *args, **kwargs)
677
url = urlutils.URL.from_string(transport.external_url())
678
url.user = url.quoted_user = None
679
url.password = url.quoted_password = None
680
super(BzrGitHttpClient, self).__init__(str(url), *args, **kwargs)
666
682
def _http_request(self, url, headers=None, data=None,
667
683
allow_compression=False):
817
833
return osutils.file_iterator(f)
819
def is_versioned(self, path, file_id=None):
835
def is_versioned(self, path):
820
836
raise GitSmartRemoteNotSupported(self.is_versioned, self)
822
838
def has_filename(self, path):
823
839
raise GitSmartRemoteNotSupported(self.has_filename, self)
825
def get_file_text(self, path, file_id=None):
841
def get_file_text(self, path):
826
842
raise GitSmartRemoteNotSupported(self.get_file_text, self)
829
845
class RemoteGitRepository(GitRepository):
847
supports_random_access = False
832
850
def user_url(self):
833
851
return self.control_url