hgitaly 2.8.0__tar.gz → 2.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. {hgitaly-2.8.0/hgitaly.egg-info → hgitaly-2.8.1}/PKG-INFO +2 -2
  2. hgitaly-2.8.1/hgitaly/VERSION +1 -0
  3. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/gitlab_ref.py +51 -3
  4. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/fixture.py +13 -2
  5. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_mercurial_operations.py +4 -3
  6. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_operations.py +4 -3
  7. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/common.py +3 -1
  8. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_branch.py +4 -1
  9. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_gitlab_ref.py +30 -2
  10. {hgitaly-2.8.0 → hgitaly-2.8.1/hgitaly.egg-info}/PKG-INFO +2 -2
  11. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly.egg-info/requires.txt +1 -1
  12. {hgitaly-2.8.0 → hgitaly-2.8.1}/install-requirements.txt +1 -1
  13. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/comparison.py +4 -0
  14. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/hgitaly_rhgitaly_comparison.py +1 -0
  15. hgitaly-2.8.0/hgitaly/VERSION +0 -1
  16. {hgitaly-2.8.0 → hgitaly-2.8.1}/LICENSE +0 -0
  17. {hgitaly-2.8.0 → hgitaly-2.8.1}/MANIFEST.in +0 -0
  18. {hgitaly-2.8.0 → hgitaly-2.8.1}/README.md +0 -0
  19. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/__init__.py +0 -0
  20. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/hgitaly/__init__.py +0 -0
  21. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/hgitaly/revset.py +0 -0
  22. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/hgitaly/tests/__init__.py +0 -0
  23. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/hgitaly/tests/test_revset.py +0 -0
  24. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgext3rd/hgitaly/tests/test_serve.py +0 -0
  25. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/__init__.py +0 -0
  26. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/branch.py +0 -0
  27. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/changelog.py +0 -0
  28. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/diff.py +0 -0
  29. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/errors.py +0 -0
  30. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/feature.py +0 -0
  31. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/file_content.py +0 -0
  32. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/file_context.py +0 -0
  33. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/git.py +0 -0
  34. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/license_detector/__init__.py +0 -0
  35. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/license_detector/spdx-licenses.json +0 -0
  36. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/linguist/__init__.py +0 -0
  37. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/linguist/languages.json +0 -0
  38. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/logging.py +0 -0
  39. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/manifest.py +0 -0
  40. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/message.py +0 -0
  41. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/oid.py +0 -0
  42. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/pagination.py +0 -0
  43. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/path.py +0 -0
  44. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/peer.py +0 -0
  45. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/procutil.py +0 -0
  46. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/repository.py +0 -0
  47. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/revision.py +0 -0
  48. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/revset.py +0 -0
  49. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/scripts.py +0 -0
  50. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/__init__.py +0 -0
  51. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/address.py +0 -0
  52. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/mono.py +0 -0
  53. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/prefork.py +0 -0
  54. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/tests/__init__.py +0 -0
  55. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/tests/test_address.py +0 -0
  56. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/tests/test_mono.py +0 -0
  57. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/tests/test_prefork.py +0 -0
  58. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/tests/test_worker.py +0 -0
  59. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/server/worker.py +0 -0
  60. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/__init__.py +0 -0
  61. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/analysis.py +0 -0
  62. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/blob.py +0 -0
  63. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/commit.py +0 -0
  64. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/diff.py +0 -0
  65. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/interceptors.py +0 -0
  66. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/mercurial_changeset.py +0 -0
  67. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/mercurial_operations.py +0 -0
  68. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/mercurial_repository.py +0 -0
  69. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/operations.py +0 -0
  70. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/ref.py +0 -0
  71. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/repository.py +0 -0
  72. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/server.py +0 -0
  73. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/__init__.py +0 -0
  74. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_analysis.py +0 -0
  75. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_blob.py +0 -0
  76. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_commit.py +0 -0
  77. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_default_branch.py +0 -0
  78. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_diff.py +0 -0
  79. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_mercurial_changeset.py +0 -0
  80. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_mercurial_repository.py +0 -0
  81. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_ref.py +0 -0
  82. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_repository_service.py +0 -0
  83. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/service/tests/test_server.py +0 -0
  84. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/servicer.py +0 -0
  85. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/ssh.py +0 -0
  86. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stream.py +0 -0
  87. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/__init__.py +0 -0
  88. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/analysis_pb2.py +0 -0
  89. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/analysis_pb2_grpc.py +0 -0
  90. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/blob_pb2.py +0 -0
  91. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/blob_pb2_grpc.py +0 -0
  92. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/commit_pb2.py +0 -0
  93. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/commit_pb2_grpc.py +0 -0
  94. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/diff_pb2.py +0 -0
  95. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/diff_pb2_grpc.py +0 -0
  96. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/errors_pb2.py +0 -0
  97. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/errors_pb2_grpc.py +0 -0
  98. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/lint_pb2.py +0 -0
  99. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/lint_pb2_grpc.py +0 -0
  100. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_changeset_pb2.py +0 -0
  101. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_changeset_pb2_grpc.py +0 -0
  102. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_operations_pb2.py +0 -0
  103. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_operations_pb2_grpc.py +0 -0
  104. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_repository_pb2.py +0 -0
  105. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/mercurial_repository_pb2_grpc.py +0 -0
  106. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/operations_pb2.py +0 -0
  107. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/operations_pb2_grpc.py +0 -0
  108. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/ref_pb2.py +0 -0
  109. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/ref_pb2_grpc.py +0 -0
  110. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/repository_pb2.py +0 -0
  111. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/repository_pb2_grpc.py +0 -0
  112. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/server_pb2.py +0 -0
  113. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/server_pb2_grpc.py +0 -0
  114. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/shared_pb2.py +0 -0
  115. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/stub/shared_pb2_grpc.py +0 -0
  116. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tag.py +0 -0
  117. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/__init__.py +0 -0
  118. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/bundle.py +0 -0
  119. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/context.py +0 -0
  120. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/grpc.py +0 -0
  121. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/ssh.py +0 -0
  122. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/sshd.py +0 -0
  123. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/tests/__init__.py +0 -0
  124. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/testing/tests/test_sshd.py +0 -0
  125. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/__init__.py +0 -0
  126. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_diff.py +0 -0
  127. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_errors.py +0 -0
  128. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_feature.py +0 -0
  129. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_file_context.py +0 -0
  130. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_license_detector.py +0 -0
  131. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_linguist.py +0 -0
  132. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_manifest.py +0 -0
  133. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_messages.py +0 -0
  134. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_oid.py +0 -0
  135. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_peer.py +0 -0
  136. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_repository.py +0 -0
  137. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_revision.py +0 -0
  138. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_revset.py +0 -0
  139. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_servicer.py +0 -0
  140. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_stream.py +0 -0
  141. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_tag.py +0 -0
  142. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/tests/test_workdir.py +0 -0
  143. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/util.py +0 -0
  144. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly/workdir.py +0 -0
  145. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly.egg-info/SOURCES.txt +0 -0
  146. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly.egg-info/dependency_links.txt +0 -0
  147. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly.egg-info/entry_points.txt +0 -0
  148. {hgitaly-2.8.0 → hgitaly-2.8.1}/hgitaly.egg-info/top_level.txt +0 -0
  149. {hgitaly-2.8.0 → hgitaly-2.8.1}/setup.cfg +0 -0
  150. {hgitaly-2.8.0 → hgitaly-2.8.1}/setup.py +0 -0
  151. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/__init__.py +0 -0
  152. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/conftest.py +0 -0
  153. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/gitaly.py +0 -0
  154. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/rhgitaly.py +0 -0
  155. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_blob_tree.py +0 -0
  156. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_commit.py +0 -0
  157. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_comparison.py +0 -0
  158. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_diff.py +0 -0
  159. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_gitaly_server.py +0 -0
  160. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_mercurial_repository.py +0 -0
  161. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_operations.py +0 -0
  162. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_ref.py +0 -0
  163. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_repository_service.py +0 -0
  164. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_rhgitaly_server.py +0 -0
  165. {hgitaly-2.8.0 → hgitaly-2.8.1}/tests_with_gitaly/test_server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hgitaly
3
- Version: 2.8.0
3
+ Version: 2.8.1
4
4
  Summary: Server-side implementation of Gitaly protocol for Mercurial
5
5
  Home-page: https://foss.heptapod.net/heptapod/hgitaly
6
6
  Author: Georges Racinet
@@ -10,7 +10,7 @@ Keywords: hg mercurial heptapod gitlab
10
10
  Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: heptapod>=4.4.1dev0
13
+ Requires-Dist: heptapod<4.9,>=4.8.0dev0
14
14
  Requires-Dist: protobuf~=4.21.0
15
15
  Requires-Dist: grpcio~=1.58.0
16
16
  Requires-Dist: grpcio-status~=1.58.0
@@ -0,0 +1 @@
1
+ 2.8.1
@@ -13,6 +13,8 @@ utilities about refs, i.e, anything about a full ref path, such as
13
13
  or tags.
14
14
  """
15
15
  from fnmatch import fnmatch
16
+ import os
17
+ import re
16
18
 
17
19
  from heptapod.gitlab.branch import gitlab_branch_ref
18
20
  from heptapod.gitlab.tag import gitlab_tag_ref
@@ -30,10 +32,40 @@ from hgext3rd.heptapod.special_ref import (
30
32
  )
31
33
  from hgext3rd.heptapod.keep_around import (
32
34
  iter_keep_arounds,
35
+ init_keep_arounds,
33
36
  KEEP_AROUND_REF_PREFIX,
34
37
  KEEP_AROUND_REF_PREFIX_LEN,
35
38
  )
36
39
 
40
+ DOT_HG_RX = re.compile(br'\.hg$')
41
+
42
+
43
+ def has_legacy_git_repo(repo):
44
+ """Return whether there is a legacy Git repo for this Mercurial repo.
45
+
46
+ With "legacy" here is meant the Git repository for a non-native project.
47
+ Git repositories meant for mirroring are *not* included in this scope.
48
+
49
+ As of Heptapod 17.6, this is the best way to know without direct indication
50
+ (from the inside) that a repository is not legacy (hg-git based).
51
+ The reverse implication is false, as there are loopholes:
52
+
53
+ - leftover Git repositories for Projects that have migrated to native
54
+ - native projects with addition conversion for mirrors whose Git
55
+ repositories have not been moved yet (bug, time to run the migration,
56
+ etc.)
57
+
58
+ The caller must be aware of these loopholes and avoid overwriting existing
59
+ data based on the legacy Git repo. In the intended case where this is to
60
+ decide on calling the `ensure` methods, this means it is ok only if there
61
+ is no existing data.
62
+ """
63
+ # if a repository is legacy, based on hg-git conversion, is whether
64
+ # it has a `.git` repository at the same location. Git repositories
65
+ # for mirroring are in a different place
66
+ git_path = DOT_HG_RX.sub(b'', repo.root) + b'.git'
67
+ return os.path.exists(git_path)
68
+
37
69
 
38
70
  def gitlab_special_ref_target(repo, ref_path):
39
71
  """Return the changeset for a special ref.
@@ -115,7 +147,23 @@ def iter_gitlab_special_refs_as_refs(repo, deref=True, patterns=None):
115
147
 
116
148
 
117
149
  def ensure_special_refs(repo):
118
- return ensure_gitlab_special_refs(repo.ui, repo)
150
+ if has_legacy_git_repo(repo):
151
+ return ensure_gitlab_special_refs(repo.ui, repo)
152
+ return {}
153
+
154
+
155
+ def ensure_keep_arounds(repo, init_empty=False):
156
+ """Ensure keep around from Git repo if present or create.
157
+
158
+ An empty file is created so that the keep-arounds file is no
159
+ more missing, but only if `init_empty` is `True`, so that
160
+ responsibility is handed to the caller, than must use the
161
+ option only after having obtained the missing marker.
162
+ """
163
+ if has_legacy_git_repo(repo):
164
+ ensure_gitlab_keep_arounds(repo.ui, repo)
165
+ elif init_empty:
166
+ init_keep_arounds(repo, ())
119
167
 
120
168
 
121
169
  def has_keep_around(repo, sha):
@@ -125,7 +173,7 @@ def has_keep_around(repo, sha):
125
173
  """
126
174
  for ka in iter_keep_arounds(repo):
127
175
  if ka is GITLAB_TYPED_REFS_MISSING:
128
- ensure_gitlab_keep_arounds(repo.ui, repo)
176
+ ensure_keep_arounds(repo, init_empty=True)
129
177
  return has_keep_around(repo, sha)
130
178
  if ka == sha:
131
179
  return True
@@ -146,7 +194,7 @@ def parse_keep_around_ref_path(ref):
146
194
  def iter_keep_arounds_as_refs(repo, deref=True, patterns=None):
147
195
  for sha in iter_keep_arounds(repo):
148
196
  if sha is GITLAB_TYPED_REFS_MISSING:
149
- ensure_gitlab_keep_arounds(repo.ui, repo)
197
+ ensure_keep_arounds(repo, init_empty=True)
150
198
  yield from iter_keep_arounds_as_refs(repo, deref=deref)
151
199
  return
152
200
  ref_path = keep_around_ref_path(sha)
@@ -155,6 +155,17 @@ class ServiceFixture:
155
155
  """
156
156
  return self.storage_path(**kw) / rel_path
157
157
 
158
+ def side_git_repo_path(self, hg_path, **kw):
159
+ hg_rel_path = hg_path.relative_to(self.storage_path(**kw))
160
+ git_rel_path = str(hg_rel_path).split('.hg', 1)[0] + '.git'
161
+ return self.storage_path(**kw) / '+hgitaly/hg-git' / git_rel_path
162
+
163
+ def side_git_repo(self, hg_path, **kw):
164
+ path = self.side_git_repo_path(hg_path, **kw)
165
+ if not path.exists(): # can happen if no transaction occurred
166
+ path = hg_path.with_suffix('.git')
167
+ return GitRepo(path)
168
+
158
169
  def make_repo_wrapper(self, rel_path, **kw):
159
170
  """Utility method to avoid depending too much on actual disk layout.
160
171
 
@@ -181,8 +192,8 @@ class ServiceFixture:
181
192
  metadata.append((CORRELATION_ID_MD_KEY, corr_id))
182
193
  return metadata
183
194
 
184
- def git_repo(self):
185
- return GitRepo(str(self.repo_wrapper.path) + '.git')
195
+ def git_repo(self, **storage_kw):
196
+ return self.side_git_repo(self.repo_wrapper.path, **storage_kw)
186
197
 
187
198
 
188
199
  class MutationServiceFixture(ServiceFixture):
@@ -20,7 +20,6 @@ from google.protobuf.timestamp_pb2 import Timestamp
20
20
  from hgext3rd.heptapod.branch import (
21
21
  gitlab_branches,
22
22
  )
23
- from heptapod.testhelpers.git import GitRepo
24
23
 
25
24
  from hgitaly.changelog import ancestor
26
25
  from hgitaly.errors import (
@@ -244,7 +243,7 @@ def test_publish_changeset(operations_fixture, project_mode):
244
243
 
245
244
  # because of the config set by fixture, operations through wrapper
246
245
  # are performed in all cases with Git mirroring.
247
- git_repo = GitRepo(str(wrapper.path) + '.git')
246
+ git_repo = fixture.git_repo()
248
247
  initial_git_branches = git_repo.branches()
249
248
 
250
249
  default_ref = b'refs/heads/branch/default'
@@ -278,7 +277,9 @@ def test_publish_changeset(operations_fixture, project_mode):
278
277
  # expect Git branches not to have moved
279
278
  assert git_repo.branches() == initial_git_branches
280
279
  else:
281
- # expect Git branch to point on new commit
280
+ # expect Git branch to point on new commit (and Git repo has moved
281
+ # to the protected location so we need to reinstantiate it)
282
+ git_repo = fixture.git_repo()
282
283
  assert git_repo.branches()[b'branch/default']['title'] == b'topical'
283
284
 
284
285
  # error cases
@@ -15,7 +15,6 @@ from mercurial import (
15
15
  phases,
16
16
  )
17
17
 
18
- from heptapod.testhelpers.git import GitRepo
19
18
  from hgext3rd.heptapod.branch import (
20
19
  gitlab_branches,
21
20
  )
@@ -81,7 +80,7 @@ def test_user_squash(operations_fixture, project_mode, timestamp):
81
80
  sha3 = wrapper.commit_file('foo', message='foo3').hex().decode('ascii')
82
81
  wrapper.update(sha1) # avoid keeping changeset 3 visible
83
82
  # let's confirm it
84
- git_repo = GitRepo(str(wrapper.path) + '.git')
83
+ git_repo = fixture.git_repo()
85
84
  before_squash_git_branches = git_repo.branches()
86
85
  assert before_squash_git_branches[b'branch/default']['title'] == b'foo3'
87
86
 
@@ -130,7 +129,9 @@ def test_user_squash(operations_fixture, project_mode, timestamp):
130
129
  # expect Git branches not to have moved
131
130
  assert git_repo.branches() == before_squash_git_branches
132
131
  else:
133
- # expect Git branch to point on new commit
132
+ # expect Git branch to point on new commit (also Git repo may have
133
+ # moved, let's also reload it)
134
+ git_repo = fixture.git_repo()
134
135
  assert git_repo.branches()[b'branch/default']['title'] == b'squashed!'
135
136
 
136
137
  for kw in (
@@ -47,8 +47,10 @@ def make_empty_repo(storages_root, relative_path=None, storage='default',
47
47
  relative_path = 'repo-' + hex(random.getrandbits(64))[2:]
48
48
  repo_path = storages_root / storage / relative_path
49
49
  if config is None:
50
- config = MINIMAL_HG_CONFIG
50
+ config = deepcopy(MINIMAL_HG_CONFIG)
51
51
 
52
+ config.setdefault('heptapod', {}
53
+ )['repositories-root'] = str(storages_root / storage)
52
54
  config['extensions'].update((ext, '') for ext in extra_extensions)
53
55
  wrapper = LocalRepoWrapper.init(repo_path, config=config)
54
56
  wrapper.write_hgrc(config)
@@ -31,9 +31,12 @@ from hgext3rd.heptapod.branch import (
31
31
 
32
32
 
33
33
  def make_repo(path):
34
- return LocalRepoWrapper.init(path,
34
+ return LocalRepoWrapper.init(path / 'repo.hg',
35
35
  config=dict(
36
36
  extensions=dict(topic='', evolve=''),
37
+ heptapod={
38
+ 'repositories-root': str(path)
39
+ }
37
40
  ))
38
41
 
39
42
 
@@ -4,6 +4,8 @@
4
4
  # GNU General Public License version 2 or any later version.
5
5
  #
6
6
  # SPDX-License-Identifier: GPL-2.0-or-later
7
+ from copy import deepcopy
8
+ import shutil
7
9
 
8
10
  import pytest
9
11
  from heptapod.testhelpers import (
@@ -28,11 +30,14 @@ from ..gitlab_ref import (
28
30
  keep_around_ref_path,
29
31
  parse_keep_around_ref_path,
30
32
  )
33
+ from .. import gitlab_ref as glref_mod # for monkey-patching
31
34
 
32
35
 
33
36
  @pytest.fixture
34
37
  def repo_wrapper(tmpdir):
35
- wrapper = LocalRepoWrapper.init(tmpdir, config=MINIMAL_HG_CONFIG)
38
+ config = deepcopy(MINIMAL_HG_CONFIG)
39
+ config.setdefault('heptapod', {})['repositories-root'] = tmpdir
40
+ wrapper = LocalRepoWrapper.init(tmpdir / 'repo.hg', config=config)
36
41
  yield wrapper.repo, wrapper
37
42
 
38
43
 
@@ -40,8 +45,12 @@ def repo_wrapper(tmpdir):
40
45
  def mirror(tmpdir, monkeypatch):
41
46
  config = MINIMAL_HG_CONFIG.copy()
42
47
  config['extensions']['heptapod'] = ''
48
+ config.setdefault('heptapod', {}).update((
49
+ ('native', 'no'),
50
+ ('repositories-root', tmpdir),
51
+ ))
43
52
 
44
- with GitLabMirrorFixture.init(tmpdir, monkeypatch,
53
+ with GitLabMirrorFixture.init(tmpdir / 'repos', monkeypatch,
45
54
  common_repo_name='repo',
46
55
  hg_config=config) as mirror:
47
56
  mirror.activate_mirror()
@@ -90,6 +99,25 @@ def test_gitlab_special_ref_target_ensure(mirror):
90
99
  assert gitlab_special_ref_target(wrapper.repo, ref_path) == ctx
91
100
 
92
101
 
102
+ def should_not_be_called(*a, **kw): # pragma: no cover
103
+ raise AssertionError("should not have been called")
104
+
105
+
106
+ def test_special_ref_not_ensure(mirror, monkeypatch):
107
+ wrapper = mirror.hg_repo_wrapper
108
+ git_repo = mirror.git_repo
109
+
110
+ shutil.rmtree(git_repo.path)
111
+ monkeypatch.setattr(glref_mod, 'ensure_gitlab_special_refs',
112
+ should_not_be_called)
113
+ monkeypatch.setattr(glref_mod, 'ensure_gitlab_keep_arounds',
114
+ should_not_be_called)
115
+
116
+ ref_path = b'refs/environments/654'
117
+ assert gitlab_special_ref_target(wrapper.repo, ref_path) is None
118
+ assert tuple(iter_keep_arounds_as_refs(wrapper.repo)) == ()
119
+
120
+
93
121
  def test_write_special_ref(repo_wrapper):
94
122
  repo, wrapper = repo_wrapper
95
123
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hgitaly
3
- Version: 2.8.0
3
+ Version: 2.8.1
4
4
  Summary: Server-side implementation of Gitaly protocol for Mercurial
5
5
  Home-page: https://foss.heptapod.net/heptapod/hgitaly
6
6
  Author: Georges Racinet
@@ -10,7 +10,7 @@ Keywords: hg mercurial heptapod gitlab
10
10
  Requires-Python: >=3.8
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: heptapod>=4.4.1dev0
13
+ Requires-Dist: heptapod<4.9,>=4.8.0dev0
14
14
  Requires-Dist: protobuf~=4.21.0
15
15
  Requires-Dist: grpcio~=1.58.0
16
16
  Requires-Dist: grpcio-status~=1.58.0
@@ -1,4 +1,4 @@
1
- heptapod>=4.4.1dev0
1
+ heptapod<4.9,>=4.8.0dev0
2
2
  protobuf~=4.21.0
3
3
  grpcio~=1.58.0
4
4
  grpcio-status~=1.58.0
@@ -1,4 +1,4 @@
1
- heptapod>=4.4.1dev0
1
+ heptapod>=4.8.0dev0,<4.9
2
2
  protobuf~=4.21.0
3
3
  grpcio~=1.58.0
4
4
  grpcio-status~=1.58.0
@@ -170,6 +170,10 @@ def gitaly_comparison_fixture(server_repos_root,
170
170
 
171
171
  hg_config = dict(phases=dict(publish=False),
172
172
  ui=dict(username='Hgitaly Tests <hgitaly@heptapod.test>'),
173
+ heptapod={
174
+ 'native': 'no',
175
+ 'repositories-root': str(server_repos_root / storage),
176
+ },
173
177
  extensions={name: '' for name in ('evolve',
174
178
  'hggit',
175
179
  'topic',
@@ -140,6 +140,7 @@ def hgitaly_rhgitaly_comparison_fixture(server_repos_root,
140
140
  hg_config = dict(
141
141
  phases=dict(publish=False),
142
142
  ui=dict(username='Hgitaly Tests <hgitaly@heptapod.test>'),
143
+ heptapod={'repositories-root': str(server_repos_root / storage)},
143
144
  extensions={name: '' for name in ('evolve',
144
145
  'topic',
145
146
  'hgitaly',
@@ -1 +0,0 @@
1
- 2.8.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes