415
417
push_result.branch_push_result = None
416
418
repo = self.find_repository()
417
419
refname = self._get_selected_ref(name)
418
def get_changed_refs(refs):
419
self._refs = dict(refs)
421
ret[refname] = repo.lookup_bzr_revision_id(revision_id)[0]
423
420
source_store = get_object_store(source.repository)
425
generate_pack_data = source_store.generate_lossy_pack_data
427
generate_pack_data = source_store.generate_pack_data
428
new_refs = self.send_pack(get_changed_refs, generate_pack_data)
421
with source_store.lock_read():
422
def get_changed_refs(refs):
423
self._refs = remote_refs_dict_to_container(refs)
425
# TODO(jelmer): Unpeel if necessary
427
ret[refname] = source_store._lookup_revision_sha1(revision_id)
429
ret[refname] = repo.lookup_bzr_revision_id(revision_id)[0]
432
generate_pack_data = source_store.generate_lossy_pack_data
434
generate_pack_data = source_store.generate_pack_data
435
new_refs = self.send_pack(get_changed_refs, generate_pack_data)
429
436
push_result.new_revid = repo.lookup_foreign_revision_id(
430
437
new_refs[refname])
431
self._refs.update(new_refs)
432
push_result.old_revid = repo.lookup_foreign_revision_id(
433
self._refs.get(refname, ZERO_SHA))
439
old_remote = self._refs[refname]
441
old_remote = ZERO_SHA
442
push_result.old_revid = repo.lookup_foreign_revision_id(old_remote)
443
self._refs = remote_refs_dict_to_container(new_refs)
434
444
push_result.old_revno = None
435
445
push_result.target_branch = self.open_branch(name)
446
if old_remote != ZERO_SHA:
447
push_result.branch_push_result = GitBranchPushResult()
448
push_result.branch_push_result.source_branch = source
449
push_result.branch_push_result.target_branch = push_result.target_branch
450
push_result.branch_push_result.local_branch = None
451
push_result.branch_push_result.master_branch = push_result.target_branch
452
push_result.branch_push_result.old_revid = push_result.old_revid
453
push_result.branch_push_result.new_revid = push_result.new_revid
436
454
if source.get_push_location() is None or remember:
437
455
source.set_push_location(push_result.target_branch.base)
438
456
return push_result