Skip to content
Snippets Groups Projects
Commit 2fc9ad94 authored by Georges Racinet's avatar Georges Racinet
Browse files

RefService.DeleteRefs: setup mutualization in comparison test

This should distract readers a bit less.
parent cebd3b97
No related branches found
No related tags found
1 merge request!67RefService.DeleteRefs implement `except_prefix`
......@@ -72,6 +72,7 @@
# TODO get_branch_sha does not work because of PosixPath not having
# the join method (py.path.local does)
git_sha = git_repo.branches()[b'branch/default']['sha']
hg_sha = base_hg_ctx.hex()
mr_ref_name = b'merge-requests/2/train'
mr_ref_path = b'refs/' + mr_ref_name
......@@ -75,8 +76,16 @@
mr_ref_name = b'merge-requests/2/train'
mr_ref_path = b'refs/' + mr_ref_name
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, base_hg_ctx.hex())
def setup_mr_ref():
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, hg_sha)
# invalidation TODO use the future wrapper.reload()
setattr(hg_repo, '_gitlab_refs_special-refs', None)
assert mr_ref_path in git_repo.all_refs()
assert mr_ref_name in special_refs(hg_repo)
setup_mr_ref()
def do_rpc(vcs, refs=(), except_prefixes=()):
return vcs_channels[vcs].DeleteRefs(
......@@ -100,13 +109,7 @@
assert do_rpc('hg', refs=[unknown]) == do_rpc('git', refs=[unknown])
# also mixing unknown with known is ok
git_repo.write_ref(mr_ref_path.decode(), git_sha)
write_gitlab_special_ref(hg_repo, mr_ref_name, base_hg_ctx.hex())
# TODO use the future wrapper.reload()
setattr(hg_repo, '_gitlab_refs_special-refs', None)
mixed_refs = [unknown, mr_ref_path]
assert mr_ref_path in git_repo.all_refs()
assert mr_ref_name in special_refs(hg_repo)
setup_mr_ref()
assert do_rpc('hg', refs=mixed_refs) == do_rpc('git', refs=mixed_refs)
assert git_repo.all_refs() == {b'refs/heads/branch/default': git_sha}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment