# HG changeset patch # User Georges Racinet <georges.racinet@octobus.net> # Date 1689764147 -7200 # Wed Jul 19 12:55:47 2023 +0200 # Node ID 68eb7d79d0910fa8a85a3953f59329ad3a6ffd2e # Parent 4934b551d540ffb4f80c232371f5274d05ceb1ad RefService.ListRefs: comment that we ignore the `peel_tags` option This is specified in protocol (all explained in added comment method implementation). Closes #138 diff --git a/hgitaly/service/ref.py b/hgitaly/service/ref.py --- a/hgitaly/service/ref.py +++ b/hgitaly/service/ref.py @@ -475,6 +475,19 @@ refs = [r for r in refs if r[1].encode('ascii') in pointing_at or r[0] == b'HEAD'] + # ignore `peel_tags`: + # Mercurial has no real equivalent of Git's annotated tags. The + # closest notion would be the tagging changeset, but that is not + # well-defined. Hence Mercurial tags always point to the target commit. + # We could force the `peeled_target` attribute of the `Reference` + # messages, but that would not bring us to better compliance: the + # protocol comment states explicitely that it should stay empty if + # the object is not an annotated tag, and this is confirmed by + # Gitaly Comparison tests (tag created by hg-git in this case). + # On the contrary, filling-in `peeled_target` could very well make + # clients believe that the tag is annotated, leading to dedicated + # actions that can only go wrong. + if len(refs) < (2 if request.head else 1): # avoid yielding an empty response, as Gitaly does not. # TODO consider doing that in the `chunked()` helper, diff --git a/tests_with_gitaly/test_ref.py b/tests_with_gitaly/test_ref.py --- a/tests_with_gitaly/test_ref.py +++ b/tests_with_gitaly/test_ref.py @@ -354,4 +354,3 @@ rpc_helper.assert_compare(pointing_at_oids=[hg_shas[i]], patterns=[b'refs/tags/'], head=head) - # TODO peel tags