hgitaly 18.2.2__tar.gz → 18.3.0__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.
- {hgitaly-18.2.2/hgitaly.egg-info → hgitaly-18.3.0}/PKG-INFO +4 -4
- hgitaly-18.3.0/hgitaly/VERSION +1 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/diff.py +36 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/errors.py +3 -2
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/commit.py +5 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/diff.py +2 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/operations.py +35 -38
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_commit.py +2 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_diff.py +82 -31
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_operations.py +16 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/analysis_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/analysis_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/blob_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/blob_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/commit_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/commit_pb2_grpc.py +4 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/diff_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/diff_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/errors_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/errors_pb2_grpc.py +2 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/lint_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/lint_pb2_grpc.py +2 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_aux_git_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_aux_git_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_changeset_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_changeset_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_operations_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_operations_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_repository_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/mercurial_repository_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/operations_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/operations_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/ref_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/ref_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/remote_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/remote_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/repository_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/repository_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/server_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/server_pb2_grpc.py +3 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/shared_pb2.py +11 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/shared_pb2_grpc.py +2 -7
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/bundle.py +10 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_errors.py +4 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0/hgitaly.egg-info}/PKG-INFO +4 -4
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly.egg-info/requires.txt +3 -3
- {hgitaly-18.2.2 → hgitaly-18.3.0}/install-requirements.txt +3 -3
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_commit.py +5 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_diff.py +24 -8
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_operations.py +2 -3
- hgitaly-18.2.2/hgitaly/VERSION +0 -1
- {hgitaly-18.2.2 → hgitaly-18.3.0}/LICENSE +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/MANIFEST.in +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/README.md +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/hgitaly/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/hgitaly/revset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/hgitaly/tests/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/hgitaly/tests/test_revset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgext3rd/hgitaly/tests/test_serve.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/branch.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/changelog.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/feature.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/file_content.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/file_context.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/git.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/gitlab_ref.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/identification.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/logging.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/manifest.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/message.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/oid.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/pagination.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/path.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/peer.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/procutil.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/revision.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/revset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/scripts.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/address.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/mono.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/prefork.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/tests/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/tests/test_address.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/tests/test_mono.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/tests/test_prefork.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/tests/test_worker.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/server/worker.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/analysis.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/blob.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/interceptors.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/mercurial_changeset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/mercurial_operations.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/mercurial_repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/ref.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/server.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/fixture.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_analysis.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_blob.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_default_branch.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_mercurial_changeset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_mercurial_operations.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_mercurial_repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_ref.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_repository_service.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/service/tests/test_server.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/servicer.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/ssh.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stream.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/stub/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tag.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/context.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/grpc.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/multiprocessing.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/ssh.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/sshd.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/storage.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/tests/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/testing/tests/test_sshd.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/common.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_branch.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_diff.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_feature.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_file_context.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_gitlab_ref.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_identification.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_manifest.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_messages.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_oid.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_peer.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_revision.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_revset.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_servicer.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_stream.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_tag.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/tests/test_workdir.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/util.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly/workdir.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly.egg-info/SOURCES.txt +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly.egg-info/dependency_links.txt +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly.egg-info/entry_points.txt +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/hgitaly.egg-info/top_level.txt +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/setup.cfg +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/setup.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/__init__.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/comparison.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/conftest.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/gitaly.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/hgitaly_rhgitaly_comparison.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/rhgitaly.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_blob_tree.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_comparison.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_gitaly_server.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_mercurial_aux_git.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_mercurial_operations.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_mercurial_repository.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_ref.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_remote.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_repository_service.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_rhgitaly_server.py +0 -0
- {hgitaly-18.2.2 → hgitaly-18.3.0}/tests_with_gitaly/test_server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hgitaly
|
|
3
|
-
Version: 18.
|
|
3
|
+
Version: 18.3.0
|
|
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
|
|
@@ -11,9 +11,9 @@ Requires-Python: >=3.8
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
13
|
Requires-Dist: heptapod>=5.2.0dev0
|
|
14
|
-
Requires-Dist: protobuf~=
|
|
15
|
-
Requires-Dist: grpcio~=1.
|
|
16
|
-
Requires-Dist: grpcio-status~=1.
|
|
14
|
+
Requires-Dist: protobuf~=6.31.1
|
|
15
|
+
Requires-Dist: grpcio~=1.74.0
|
|
16
|
+
Requires-Dist: grpcio-status~=1.74.0
|
|
17
17
|
Requires-Dist: grpc-interceptor
|
|
18
18
|
Requires-Dist: grpcio-health-checking
|
|
19
19
|
Requires-Dist: hg-loggingmod>=0.4.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
18.3.0
|
|
@@ -32,6 +32,7 @@ from .oid import (
|
|
|
32
32
|
from .stub.diff_pb2 import (
|
|
33
33
|
ChangedPaths,
|
|
34
34
|
DiffStats,
|
|
35
|
+
FindChangedPathsRequest,
|
|
35
36
|
)
|
|
36
37
|
|
|
37
38
|
GIT_PATCH_ID_TIMEOUT_SECONDS = 10
|
|
@@ -57,8 +58,23 @@ RENAMED = ChangedPaths.Status.RENAMED
|
|
|
57
58
|
DIFF_HUNKS_START_RX = re.compile(rb'^(--- )|^(Binary file)')
|
|
58
59
|
"""To match the header line right before hunks start getting dumped."""
|
|
59
60
|
|
|
61
|
+
DiffStatus = FindChangedPathsRequest.DiffStatus
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
Status_Filter_Map = dict(
|
|
64
|
+
added=DiffStatus.DIFF_STATUS_ADDED,
|
|
65
|
+
modified=DiffStatus.DIFF_STATUS_MODIFIED,
|
|
66
|
+
removed=DiffStatus.DIFF_STATUS_DELETED,
|
|
67
|
+
copied=DiffStatus.DIFF_STATUS_COPIED,
|
|
68
|
+
renamed=DiffStatus.DIFF_STATUS_RENAMED,
|
|
69
|
+
# TODO in case TYPE_CHANGE is explicitly filtered out or included,
|
|
70
|
+
# we should make the difference.
|
|
71
|
+
)
|
|
72
|
+
"""Mapping status object attributes to DiffFilter enum."""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def changed_paths(repo, from_ctx, to_ctx, base_path,
|
|
76
|
+
find_renames=False,
|
|
77
|
+
diff_filters=()):
|
|
62
78
|
if base_path is None:
|
|
63
79
|
matcher = None
|
|
64
80
|
path_trim_at = 0
|
|
@@ -83,19 +99,32 @@ def changed_paths(repo, from_ctx, to_ctx, base_path, find_renames=False):
|
|
|
83
99
|
status = from_ctx.status(to_ctx, match=matcher)
|
|
84
100
|
# this will remove renames from copy_info, keeping only actual copies
|
|
85
101
|
yield from status_changed_paths(from_ctx, to_ctx, status, copy_info,
|
|
102
|
+
diff_filters=diff_filters,
|
|
86
103
|
find_renames=find_renames,
|
|
87
104
|
trim_at=path_trim_at)
|
|
105
|
+
if filtered_out('copied', diff_filters):
|
|
106
|
+
return
|
|
107
|
+
|
|
88
108
|
yield from copy_changed_paths(from_ctx,
|
|
89
109
|
to_ctx,
|
|
90
110
|
copy_info,
|
|
91
111
|
trim_at=path_trim_at)
|
|
92
112
|
|
|
93
113
|
|
|
114
|
+
def filtered_out(status_type, diff_filters):
|
|
115
|
+
if not diff_filters:
|
|
116
|
+
return False
|
|
117
|
+
return Status_Filter_Map[status_type] not in diff_filters
|
|
118
|
+
|
|
119
|
+
|
|
94
120
|
def status_changed_paths(from_ctx, to_ctx, status, copy_info,
|
|
121
|
+
diff_filters=(),
|
|
95
122
|
find_renames=False, trim_at=0):
|
|
96
123
|
rcopy_info = {v: k for k, v in copy_info.items()}
|
|
97
124
|
"""Return ChangedPaths from Mercurial status object"""
|
|
98
125
|
for stype in ['added', 'modified', 'removed']:
|
|
126
|
+
if stype != 'removed' and filtered_out(stype, diff_filters):
|
|
127
|
+
continue
|
|
99
128
|
for path in status.__getattribute__(stype):
|
|
100
129
|
copied_from = copy_info.get(path)
|
|
101
130
|
if copied_from is not None:
|
|
@@ -113,17 +142,23 @@ def status_changed_paths(from_ctx, to_ctx, status, copy_info,
|
|
|
113
142
|
if stype == 'removed':
|
|
114
143
|
new_path = rcopy_info.get(path)
|
|
115
144
|
if new_path is None:
|
|
145
|
+
if filtered_out(stype, diff_filters):
|
|
146
|
+
continue
|
|
116
147
|
new_mode = OBJECT_MODE_DOES_NOT_EXIST
|
|
117
148
|
new_blob_id = NULL_BLOB_OID
|
|
118
149
|
else:
|
|
119
150
|
del copy_info[new_path]
|
|
120
151
|
if find_renames:
|
|
121
152
|
stype = 'renamed'
|
|
153
|
+
if filtered_out(stype, diff_filters):
|
|
154
|
+
continue
|
|
122
155
|
old_path = path
|
|
123
156
|
path = new_path
|
|
124
157
|
new_mode = git_perms(to_ctx.filectx(new_path))
|
|
125
158
|
new_blob_id = ctx_blob_oid(to_ctx, new_path)
|
|
126
159
|
else:
|
|
160
|
+
if filtered_out(stype, diff_filters):
|
|
161
|
+
continue
|
|
127
162
|
new_mode = OBJECT_MODE_DOES_NOT_EXIST
|
|
128
163
|
new_blob_id = NULL_BLOB_OID
|
|
129
164
|
else:
|
|
@@ -103,8 +103,9 @@ def operation_error_treatment(context, error_message_class, logger,
|
|
|
103
103
|
except GitLabPreReceiveError as exc:
|
|
104
104
|
message = exc.message
|
|
105
105
|
if isinstance(message, str):
|
|
106
|
-
#
|
|
107
|
-
#
|
|
106
|
+
# almost impossible with Mercurial 7.1, because the parent class,
|
|
107
|
+
# `error.Abort` converts automatically to bytes. Still keeping
|
|
108
|
+
# this last line of defense:
|
|
108
109
|
message = message.encode('utf-8')
|
|
109
110
|
attrs = {
|
|
110
111
|
error_message_attr: CustomHookError(
|
|
@@ -613,6 +613,11 @@ class CommitServicer(CommitServiceServicer, HGitalyServicer):
|
|
|
613
613
|
context, StatusCode.NOT_FOUND, "commits not found",
|
|
614
614
|
FindCommitsError())
|
|
615
615
|
|
|
616
|
+
message_regex = request.message_regex
|
|
617
|
+
if message_regex:
|
|
618
|
+
grep = f" and grep('(?i){message_regex}')"
|
|
619
|
+
opts[b'rev'][0] += grep.encode('utf-8')
|
|
620
|
+
|
|
616
621
|
walk_opts = logcmdutil.parseopts(repo.ui, pats, opts)
|
|
617
622
|
revs, _ = logcmdutil.getrevs(repo, walk_opts)
|
|
618
623
|
|
|
@@ -525,7 +525,8 @@ class DiffServicer(DiffServiceServicer, HGitalyServicer):
|
|
|
525
525
|
for paths in chunked(path for extr in extracted
|
|
526
526
|
for path in changed_paths(
|
|
527
527
|
repo, *extr,
|
|
528
|
-
find_renames=find_renames
|
|
528
|
+
find_renames=find_renames,
|
|
529
|
+
diff_filters=request.diff_filters)):
|
|
529
530
|
yield FindChangedPathsResponse(paths=paths)
|
|
530
531
|
|
|
531
532
|
def GetPatchID(self, request: GetPatchIDRequest,
|
|
@@ -426,7 +426,9 @@ class OperationServicer(OperationServiceServicer, HGitalyServicer):
|
|
|
426
426
|
|
|
427
427
|
if header.action in (ActionType.CREATE,
|
|
428
428
|
ActionType.UPDATE):
|
|
429
|
-
content_handler = UserCommitFilesContent(
|
|
429
|
+
content_handler = UserCommitFilesContent(
|
|
430
|
+
context, wd, header
|
|
431
|
+
)
|
|
430
432
|
else:
|
|
431
433
|
content_handler = None
|
|
432
434
|
|
|
@@ -477,6 +479,31 @@ class OperationServicer(OperationServiceServicer, HGitalyServicer):
|
|
|
477
479
|
)
|
|
478
480
|
|
|
479
481
|
|
|
482
|
+
def validate_checkout_path(context, relpath):
|
|
483
|
+
# absolute paths are interpreted by Gitaly as relative to the
|
|
484
|
+
# root of checkout.
|
|
485
|
+
relpath = relpath.lstrip(b'/')
|
|
486
|
+
|
|
487
|
+
for p in FORBIDDEN_IN_PATHS:
|
|
488
|
+
if p in relpath:
|
|
489
|
+
relpath_str = relpath.decode('utf-8', 'surrogateescape')
|
|
490
|
+
|
|
491
|
+
if p == DIRECTORY_CLIMB_UP:
|
|
492
|
+
# ill-named by upstream
|
|
493
|
+
error_type = 'ERROR_TYPE_DIRECTORY_TRAVERSAL'
|
|
494
|
+
msg = 'Path cannot include directory traversal'
|
|
495
|
+
else:
|
|
496
|
+
error_type = 'ERROR_TYPE_INVALID_PATH'
|
|
497
|
+
msg = f'invalid path: "{relpath_str}"'
|
|
498
|
+
|
|
499
|
+
index_error(context,
|
|
500
|
+
status_code='INVALID_ARGUMENT',
|
|
501
|
+
error_type=error_type,
|
|
502
|
+
msg=msg,
|
|
503
|
+
path=relpath)
|
|
504
|
+
return relpath
|
|
505
|
+
|
|
506
|
+
|
|
480
507
|
class UserCommitFilesAction:
|
|
481
508
|
|
|
482
509
|
def __init__(self, context, header, working_dir, changed_files):
|
|
@@ -485,9 +512,8 @@ class UserCommitFilesAction:
|
|
|
485
512
|
self.changed_files = changed_files
|
|
486
513
|
|
|
487
514
|
wd = self.working_dir = working_dir
|
|
488
|
-
|
|
489
|
-
self.
|
|
490
|
-
self.abspath = wd.file_path(relpath)
|
|
515
|
+
self.relpath = validate_checkout_path(context, header.file_path)
|
|
516
|
+
self.abspath = wd.file_path(self.relpath)
|
|
491
517
|
|
|
492
518
|
def __call__(self):
|
|
493
519
|
action = self.header.action
|
|
@@ -504,36 +530,6 @@ class UserCommitFilesAction:
|
|
|
504
530
|
elif action == ActionType.CHMOD:
|
|
505
531
|
return self.chmod()
|
|
506
532
|
|
|
507
|
-
def validate(self, relpath):
|
|
508
|
-
if os.path.isabs(relpath):
|
|
509
|
-
index_error(
|
|
510
|
-
self.context,
|
|
511
|
-
status_code='INVALID_ARGUMENT',
|
|
512
|
-
error_type='ERROR_TYPE_INVALID_PATH',
|
|
513
|
-
msg='absolute',
|
|
514
|
-
path=relpath,
|
|
515
|
-
)
|
|
516
|
-
|
|
517
|
-
for p in FORBIDDEN_IN_PATHS:
|
|
518
|
-
if p in relpath:
|
|
519
|
-
relpath_str = relpath.decode('utf-8', 'surrogateescape')
|
|
520
|
-
|
|
521
|
-
if p == DIRECTORY_CLIMB_UP:
|
|
522
|
-
# ill-named by upstream
|
|
523
|
-
error_type = 'ERROR_TYPE_DIRECTORY_TRAVERSAL'
|
|
524
|
-
msg = 'Path cannot include directory traversal'
|
|
525
|
-
else:
|
|
526
|
-
error_type = 'ERROR_TYPE_INVALID_PATH'
|
|
527
|
-
msg = f'invalid path: "{relpath_str}"'
|
|
528
|
-
|
|
529
|
-
index_error(
|
|
530
|
-
self.context,
|
|
531
|
-
status_code='INVALID_ARGUMENT',
|
|
532
|
-
error_type=error_type,
|
|
533
|
-
msg=msg,
|
|
534
|
-
path=relpath,
|
|
535
|
-
)
|
|
536
|
-
|
|
537
533
|
def create(self):
|
|
538
534
|
if os.path.exists(self.abspath):
|
|
539
535
|
index_error(
|
|
@@ -600,8 +596,8 @@ class UserCommitFilesAction:
|
|
|
600
596
|
def move(self):
|
|
601
597
|
self.require_file_absence()
|
|
602
598
|
abspath = self.abspath
|
|
603
|
-
prev_relpath = self.
|
|
604
|
-
|
|
599
|
+
prev_relpath = validate_checkout_path(self.context,
|
|
600
|
+
self.header.previous_path)
|
|
605
601
|
prev_abspath = self.working_dir.file_path(prev_relpath)
|
|
606
602
|
self.require_file_existence(abspath=prev_abspath,
|
|
607
603
|
relpath=prev_relpath)
|
|
@@ -636,8 +632,9 @@ class UserCommitFilesAction:
|
|
|
636
632
|
|
|
637
633
|
class UserCommitFilesContent:
|
|
638
634
|
|
|
639
|
-
def __init__(self, workdir, header):
|
|
640
|
-
|
|
635
|
+
def __init__(self, context, workdir, header):
|
|
636
|
+
relpath = validate_checkout_path(context, header.file_path)
|
|
637
|
+
self.file_path = workdir.file_path(relpath)
|
|
641
638
|
self.fobj = open(self.file_path, 'wb')
|
|
642
639
|
self.make_hg_executable = (header.action == ActionType.CREATE
|
|
643
640
|
and header.execute_filemode)
|
|
@@ -368,6 +368,8 @@ def test_find_commits(commit_fixture_empty_repo):
|
|
|
368
368
|
assert exc_info.value.code() == grpc.StatusCode.NOT_FOUND
|
|
369
369
|
# with all, return all the commits
|
|
370
370
|
assert find_commits_ids(all=True) == [sha0, sha1, sha2, sha3, sha4]
|
|
371
|
+
# with message_regex
|
|
372
|
+
assert find_commits_ids(all=True, message_regex='FOO.*zoO') == [sha2]
|
|
371
373
|
# with offset
|
|
372
374
|
assert find_commits_ids(all=True, offset=2) == [sha2, sha3, sha4]
|
|
373
375
|
# with skip_merges
|
|
@@ -34,6 +34,13 @@ from hgitaly.stub.diff_pb2_grpc import DiffServiceStub
|
|
|
34
34
|
from .fixture import ServiceFixture
|
|
35
35
|
|
|
36
36
|
StatusCode = grpc.StatusCode
|
|
37
|
+
DiffStatus = FindChangedPathsRequest.DiffStatus
|
|
38
|
+
|
|
39
|
+
DS_ADDED = DiffStatus.DIFF_STATUS_ADDED
|
|
40
|
+
DS_MODIFIED = DiffStatus.DIFF_STATUS_MODIFIED
|
|
41
|
+
DS_DELETED = DiffStatus.DIFF_STATUS_DELETED
|
|
42
|
+
DS_COPIED = DiffStatus.DIFF_STATUS_COPIED
|
|
43
|
+
DS_RENAMED = DiffStatus.DIFF_STATUS_RENAMED
|
|
37
44
|
|
|
38
45
|
|
|
39
46
|
class DiffFixture(ServiceFixture):
|
|
@@ -170,9 +177,9 @@ def test_raw_diff(diff_fixture):
|
|
|
170
177
|
message=b'added foo')
|
|
171
178
|
ctx1 = wrapper.commit_file('foo', content="I am foo\n",
|
|
172
179
|
message=b'changes foo')
|
|
173
|
-
wrapper.command(
|
|
180
|
+
wrapper.command('mv', wrapper.repo.root + b'/foo',
|
|
174
181
|
wrapper.repo.root + b'/zoo')
|
|
175
|
-
wrapper.command(
|
|
182
|
+
wrapper.command('ci', message=b"rename foo to zoo")
|
|
176
183
|
ctx2 = wrapper.repo[b'.']
|
|
177
184
|
sha0, sha1, sha2 = ctx0.hex(), ctx1.hex(), ctx2.hex()
|
|
178
185
|
|
|
@@ -367,7 +374,7 @@ def test_commit_diff(diff_fixture):
|
|
|
367
374
|
message="Add bar")
|
|
368
375
|
ctx1 = wrapper.commit_file('bar', content="I am in\nbar\n",
|
|
369
376
|
message="Changes bar")
|
|
370
|
-
wrapper.command(
|
|
377
|
+
wrapper.command('mv', wrapper.repo.root + b'/bar',
|
|
371
378
|
wrapper.repo.root + b'/zar')
|
|
372
379
|
ctx2 = wrapper.commit([b'bar', b'zar'], message="Rename bar to zar")
|
|
373
380
|
ctx3 = wrapper.commit_file('zoo', content="I am in\nzoo\n",
|
|
@@ -470,7 +477,7 @@ def test_commit_delta(diff_fixture):
|
|
|
470
477
|
message="Add bar")
|
|
471
478
|
ctx1 = wrapper.commit_file('bar', content="I am in\nbar\n",
|
|
472
479
|
message="Changes bar")
|
|
473
|
-
wrapper.command(
|
|
480
|
+
wrapper.command('mv', wrapper.repo.root + b'/bar',
|
|
474
481
|
wrapper.repo.root + b'/zar')
|
|
475
482
|
ctx2 = wrapper.commit([b'bar', b'zar'], message="Rename bar to zar")
|
|
476
483
|
ctx3 = wrapper.commit_file('zoo', content="I am in\nzoo\n",
|
|
@@ -545,7 +552,7 @@ def test_diff_stats(diff_fixture):
|
|
|
545
552
|
message="Add bar")
|
|
546
553
|
ctx1 = wrapper.commit_file('bar', content="I am in\nbar\n",
|
|
547
554
|
message="Changes bar")
|
|
548
|
-
wrapper.command(
|
|
555
|
+
wrapper.command('mv', wrapper.repo.root + b'/bar',
|
|
549
556
|
wrapper.repo.root + b'/zar')
|
|
550
557
|
ctx2 = wrapper.commit([b'bar', b'zar'], message="Rename bar to zar")
|
|
551
558
|
ctx3 = wrapper.commit_file('zoo', content="I am in\nzoo\n",
|
|
@@ -586,8 +593,15 @@ def test_diff_stats(diff_fixture):
|
|
|
586
593
|
assert exc_info.value.code() == grpc.StatusCode.FAILED_PRECONDITION
|
|
587
594
|
|
|
588
595
|
|
|
596
|
+
def sub_dict(d, *keys):
|
|
597
|
+
"""Sub dict with given keys, after encoding to bytes."""
|
|
598
|
+
return {k.encode('ascii'): d[k.encode('ascii')]
|
|
599
|
+
for k in keys}
|
|
600
|
+
|
|
601
|
+
|
|
589
602
|
def test_find_changed_paths(diff_fixture):
|
|
590
603
|
wrapper = diff_fixture.repo_wrapper
|
|
604
|
+
repo = wrapper.repo
|
|
591
605
|
|
|
592
606
|
(wrapper.path / 'sub').mkdir()
|
|
593
607
|
(wrapper.path / 'sub/foo').write_text('foo content')
|
|
@@ -599,8 +613,7 @@ def test_find_changed_paths(diff_fixture):
|
|
|
599
613
|
(wrapper.path / 'too').chmod(0o755)
|
|
600
614
|
(wrapper.path / 'sub/foo').write_text('foo content modified')
|
|
601
615
|
(wrapper.path / 'bar').unlink()
|
|
602
|
-
wrapper.command(
|
|
603
|
-
wrapper.repo.root + b'/zaz')
|
|
616
|
+
wrapper.command('cp', repo.root + b'/zoo', repo.root + b'/zaz')
|
|
604
617
|
ctx1 = wrapper.commit(rel_paths=['sub/foo', 'bar', 'zaz', 'too'],
|
|
605
618
|
add_remove=True)
|
|
606
619
|
|
|
@@ -635,6 +648,15 @@ def test_find_changed_paths(diff_fixture):
|
|
|
635
648
|
assert diff_fixture.find_changed_paths_commits(
|
|
636
649
|
[ctx1.hex(), ctx2.hex()]) == resp_dict
|
|
637
650
|
|
|
651
|
+
# diff_filters
|
|
652
|
+
def fcp_filtered(filters):
|
|
653
|
+
return diff_fixture.find_changed_paths_commits(
|
|
654
|
+
[ctx1.hex(), ctx2.hex()], diff_filters=filters)
|
|
655
|
+
|
|
656
|
+
assert fcp_filtered([DS_ADDED]) == sub_dict(resp_dict, 'too')
|
|
657
|
+
assert fcp_filtered([DS_MODIFIED]) == sub_dict(resp_dict, 'sub/foo')
|
|
658
|
+
assert fcp_filtered([DS_COPIED]) == sub_dict(resp_dict, 'zaz')
|
|
659
|
+
|
|
638
660
|
# Testing by passing "parents" (changesets to compare to)
|
|
639
661
|
ctx3 = wrapper.commit_file("toto")
|
|
640
662
|
assert diff_fixture.find_changed_paths_commits(
|
|
@@ -648,7 +670,6 @@ def test_find_changed_paths(diff_fixture):
|
|
|
648
670
|
}
|
|
649
671
|
|
|
650
672
|
# Tree requests
|
|
651
|
-
repo = wrapper.repo
|
|
652
673
|
sub0_oid, sub1_oid = [tree_oid(repo, ctx.hex().decode('ascii'), b'sub')
|
|
653
674
|
for ctx in (ctx0, ctx1)]
|
|
654
675
|
assert diff_fixture.find_changed_paths_tree(sub0_oid, sub1_oid) == {
|
|
@@ -669,17 +690,16 @@ def test_find_changed_paths(diff_fixture):
|
|
|
669
690
|
|
|
670
691
|
def test_find_changed_paths_copy_in_tree(diff_fixture):
|
|
671
692
|
wrapper = diff_fixture.repo_wrapper
|
|
693
|
+
repo = wrapper.repo
|
|
672
694
|
|
|
673
695
|
(wrapper.path / 'subdir').mkdir() # avoid all lengths to be 3
|
|
674
696
|
(wrapper.path / 'subdir/bar').write_text('some bar')
|
|
675
697
|
ctx0 = wrapper.commit(rel_paths=['subdir'], add_remove=True)
|
|
676
698
|
|
|
677
|
-
wrapper.command(
|
|
678
|
-
|
|
699
|
+
wrapper.command('cp', repo.root + b'/subdir/bar',
|
|
700
|
+
repo.root + b'/subdir/baz')
|
|
679
701
|
ctx1 = wrapper.commit(rel_paths=['subdir'])
|
|
680
702
|
|
|
681
|
-
repo = wrapper.repo
|
|
682
|
-
|
|
683
703
|
sub0_oid, sub1_oid = [tree_oid(repo, ctx.hex().decode('ascii'), b'subdir')
|
|
684
704
|
for ctx in (ctx0, ctx1)]
|
|
685
705
|
assert diff_fixture.find_changed_paths_tree(sub0_oid, sub1_oid) == {
|
|
@@ -689,25 +709,23 @@ def test_find_changed_paths_copy_in_tree(diff_fixture):
|
|
|
689
709
|
|
|
690
710
|
def test_find_changed_paths_rename(diff_fixture):
|
|
691
711
|
wrapper = diff_fixture.repo_wrapper
|
|
712
|
+
repo = wrapper.repo
|
|
692
713
|
|
|
693
714
|
(wrapper.path / 'subdir').mkdir() # avoid all lengths to be 3
|
|
694
715
|
(wrapper.path / 'subdir/bar').write_text('some bar')
|
|
695
716
|
ctx0 = wrapper.commit(rel_paths=['subdir'], add_remove=True)
|
|
696
717
|
|
|
697
|
-
wrapper.command(
|
|
698
|
-
|
|
718
|
+
wrapper.command('mv', repo.root + b'/subdir/bar',
|
|
719
|
+
repo.root + b'/subdir/baz')
|
|
699
720
|
ctx1 = wrapper.commit(rel_paths=['subdir'])
|
|
700
721
|
|
|
701
|
-
|
|
722
|
+
def fcp(**opts):
|
|
723
|
+
return diff_fixture.find_changed_paths_commits(
|
|
724
|
+
[ctx1.hex()],
|
|
725
|
+
compare_to=[ctx0.hex()],
|
|
726
|
+
**opts)
|
|
702
727
|
|
|
703
|
-
|
|
704
|
-
for ctx in (ctx0, ctx1)]
|
|
705
|
-
ret = diff_fixture.find_changed_paths_commits(
|
|
706
|
-
[ctx1.hex()],
|
|
707
|
-
compare_to=[ctx0.hex()],
|
|
708
|
-
find_renames=False,
|
|
709
|
-
)
|
|
710
|
-
assert ret == {
|
|
728
|
+
expected_no_renames = {
|
|
711
729
|
b'subdir/baz': [(ChangedPaths.Status.ADDED,
|
|
712
730
|
(OBJECT_MODE_DOES_NOT_EXIST,
|
|
713
731
|
OBJECT_MODE_NON_EXECUTABLE),
|
|
@@ -718,17 +736,50 @@ def test_find_changed_paths_rename(diff_fixture):
|
|
|
718
736
|
)],
|
|
719
737
|
}
|
|
720
738
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
739
|
+
assert fcp(find_renames=False) == expected_no_renames
|
|
740
|
+
assert fcp(find_renames=False,
|
|
741
|
+
diff_filters=[DS_ADDED],
|
|
742
|
+
) == sub_dict(expected_no_renames, 'subdir/baz')
|
|
743
|
+
assert fcp(find_renames=False,
|
|
744
|
+
diff_filters=[DS_DELETED],
|
|
745
|
+
) == sub_dict(expected_no_renames, 'subdir/bar')
|
|
746
|
+
|
|
747
|
+
expected_renames = {
|
|
727
748
|
b'subdir/baz': [(ChangedPaths.Status.RENAMED, None)],
|
|
728
749
|
}
|
|
750
|
+
assert fcp(find_renames=True) == expected_renames
|
|
751
|
+
assert fcp(find_renames=True,
|
|
752
|
+
diff_filters=[DS_ADDED, DS_MODIFIED, DS_DELETED]
|
|
753
|
+
) == {}
|
|
754
|
+
assert fcp(find_renames=True,
|
|
755
|
+
diff_filters=[DS_RENAMED]) == expected_renames
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
def test_find_changed_paths_rename_and_copy(diff_fixture):
|
|
759
|
+
wrapper = diff_fixture.repo_wrapper
|
|
760
|
+
repo = wrapper.repo
|
|
761
|
+
|
|
762
|
+
ctx0 = wrapper.commit_file('foo')
|
|
763
|
+
wrapper.command('cp', repo.root + b'/foo', repo.root + b'/bar')
|
|
764
|
+
wrapper.command('mv', repo.root + b'/foo', repo.root + b'/bar2')
|
|
765
|
+
ctx1 = wrapper.commit(rel_paths=['foo', 'bar', 'bar2'])
|
|
766
|
+
|
|
767
|
+
def fcp(find_renames=True, **opts):
|
|
768
|
+
return diff_fixture.find_changed_paths_commits(
|
|
769
|
+
[ctx1.hex()],
|
|
770
|
+
compare_to=[ctx0.hex()],
|
|
771
|
+
find_renames=find_renames,
|
|
772
|
+
**opts)
|
|
773
|
+
|
|
774
|
+
expected = {
|
|
775
|
+
b'bar': [(ChangedPaths.Status.COPIED, None)],
|
|
776
|
+
b'bar2': [(ChangedPaths.Status.RENAMED, None)],
|
|
777
|
+
}
|
|
729
778
|
|
|
730
|
-
|
|
731
|
-
|
|
779
|
+
assert fcp() == expected
|
|
780
|
+
assert fcp(diff_filters=[DS_ADDED]) == {}
|
|
781
|
+
assert fcp(diff_filters=[DS_RENAMED]) == sub_dict(expected, 'bar2')
|
|
782
|
+
assert fcp(diff_filters=[DS_COPIED]) == sub_dict(expected, 'bar')
|
|
732
783
|
|
|
733
784
|
|
|
734
785
|
def test_get_patch_id(diff_fixture):
|
|
@@ -757,7 +757,7 @@ def test_user_commit_files(operations_fixture, tmpdir):
|
|
|
757
757
|
assert exc_info.value.code() == StatusCode.ALREADY_EXISTS
|
|
758
758
|
|
|
759
759
|
# invalid paths
|
|
760
|
-
for path in ('double//slash', '../../../good.joke'
|
|
760
|
+
for path in ('double//slash', '../../../good.joke'):
|
|
761
761
|
with pytest.raises(RpcError) as exc_info:
|
|
762
762
|
commit_files(
|
|
763
763
|
branch_name=gl_branch,
|
|
@@ -793,6 +793,21 @@ def test_user_commit_files(operations_fixture, tmpdir):
|
|
|
793
793
|
)
|
|
794
794
|
assert exc_info.value.code() == StatusCode.INVALID_ARGUMENT
|
|
795
795
|
|
|
796
|
+
# leading slash is interpreted as meaning the root of checkout
|
|
797
|
+
resp = commit_files(
|
|
798
|
+
branch_name=gl_branch,
|
|
799
|
+
commit_message=b'Deleted intopic',
|
|
800
|
+
actions=(dict(action=ActionType.CREATE,
|
|
801
|
+
file_path=b'/etc/shadow',
|
|
802
|
+
content=b"This is in repo!",
|
|
803
|
+
),
|
|
804
|
+
)
|
|
805
|
+
)
|
|
806
|
+
hex11 = resp.branch_update.commit_id.encode()
|
|
807
|
+
wrapper.reload()
|
|
808
|
+
clone_pull_update(hex11)
|
|
809
|
+
assert (clone.path / 'etc/shadow').read_binary() == b"This is in repo!"
|
|
810
|
+
|
|
796
811
|
# bogus request flows
|
|
797
812
|
header_req = fixture.user_commit_files_header(
|
|
798
813
|
branch_name=gl_other_branch,
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: analysis.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'analysis.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -5,10 +5,8 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from . import analysis_pb2 as analysis__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.74.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
|
-
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
11
|
-
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
12
10
|
_version_not_supported = False
|
|
13
11
|
|
|
14
12
|
try:
|
|
@@ -18,15 +16,12 @@ except ImportError:
|
|
|
18
16
|
_version_not_supported = True
|
|
19
17
|
|
|
20
18
|
if _version_not_supported:
|
|
21
|
-
|
|
19
|
+
raise RuntimeError(
|
|
22
20
|
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
23
21
|
+ f' but the generated code in analysis_pb2_grpc.py depends on'
|
|
24
22
|
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
25
23
|
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
26
24
|
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
27
|
-
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
28
|
-
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
29
|
-
RuntimeWarning
|
|
30
25
|
)
|
|
31
26
|
|
|
32
27
|
|
|
@@ -78,6 +73,7 @@ def add_AnalysisServiceServicer_to_server(servicer, server):
|
|
|
78
73
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
79
74
|
'gitaly.AnalysisService', rpc_method_handlers)
|
|
80
75
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
76
|
+
server.add_registered_method_handlers('gitaly.AnalysisService', rpc_method_handlers)
|
|
81
77
|
|
|
82
78
|
|
|
83
79
|
# This class is part of an EXPERIMENTAL API.
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: blob.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'blob.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|
|
@@ -5,10 +5,8 @@ import warnings
|
|
|
5
5
|
|
|
6
6
|
from . import blob_pb2 as blob__pb2
|
|
7
7
|
|
|
8
|
-
GRPC_GENERATED_VERSION = '1.
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.74.0'
|
|
9
9
|
GRPC_VERSION = grpc.__version__
|
|
10
|
-
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
11
|
-
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
12
10
|
_version_not_supported = False
|
|
13
11
|
|
|
14
12
|
try:
|
|
@@ -18,15 +16,12 @@ except ImportError:
|
|
|
18
16
|
_version_not_supported = True
|
|
19
17
|
|
|
20
18
|
if _version_not_supported:
|
|
21
|
-
|
|
19
|
+
raise RuntimeError(
|
|
22
20
|
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
23
21
|
+ f' but the generated code in blob_pb2_grpc.py depends on'
|
|
24
22
|
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
25
23
|
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
26
24
|
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
27
|
-
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
28
|
-
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
29
|
-
RuntimeWarning
|
|
30
25
|
)
|
|
31
26
|
|
|
32
27
|
|
|
@@ -190,6 +185,7 @@ def add_BlobServiceServicer_to_server(servicer, server):
|
|
|
190
185
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
191
186
|
'gitaly.BlobService', rpc_method_handlers)
|
|
192
187
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
188
|
+
server.add_registered_method_handlers('gitaly.BlobService', rpc_method_handlers)
|
|
193
189
|
|
|
194
190
|
|
|
195
191
|
# This class is part of an EXPERIMENTAL API.
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
3
4
|
# source: commit.proto
|
|
4
|
-
# Protobuf Python Version:
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
5
6
|
"""Generated protocol buffer code."""
|
|
6
7
|
from google.protobuf import descriptor as _descriptor
|
|
7
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
8
10
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
11
|
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'commit.proto'
|
|
19
|
+
)
|
|
10
20
|
# @@protoc_insertion_point(imports)
|
|
11
21
|
|
|
12
22
|
_sym_db = _symbol_database.Default()
|