Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hgitaly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
hgitaly
Commits
681f5ef1
Commit
681f5ef1
authored
4 years ago
by
Sushil Khanchi
Browse files
Options
Downloads
Patches
Plain Diff
CommitService: implement ListFiles
parent
b5d928f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!50
commitService: implement ListFiles
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hgitaly/service/commit.py
+9
-2
9 additions, 2 deletions
hgitaly/service/commit.py
hgitaly/service/tests/test_commit.py
+26
-0
26 additions, 0 deletions
hgitaly/service/tests/test_commit.py
with
35 additions
and
2 deletions
hgitaly/service/commit.py
+
9
−
2
View file @
681f5ef1
...
...
@@ -237,8 +237,15 @@
def
ListFiles
(
self
,
request
:
ListFilesRequest
,
context
)
->
ListFilesResponse
:
return
not_implemented
(
context
,
ListFilesResponse
,
issue
=
13
)
# pragma no cover
repo
=
self
.
load_repo
(
request
.
repository
,
context
)
revision
=
pycompat
.
sysbytes
(
request
.
revision
)
logger
.
debug
(
"
ListFiles revision=%r
"
,
revision
)
ctx
=
gitlab_revision_changeset
(
repo
,
revision
)
if
ctx
is
None
:
return
mf
=
ctx
.
manifest
()
for
paths
in
chunked
(
mf
.
iterkeys
()):
yield
ListFilesResponse
(
paths
=
paths
)
def
CommitStats
(
self
,
request
:
CommitStatsRequest
,
context
)
->
CommitStatsResponse
:
...
...
This diff is collapsed.
Click to expand it.
hgitaly/service/tests/test_commit.py
+
26
−
0
View file @
681f5ef1
...
...
@@ -32,6 +32,7 @@
LastCommitForPathRequest
,
ListCommitsByOidRequest
,
ListCommitsByRefNameRequest
,
ListFilesRequest
,
ListLastCommitsForTreeRequest
,
RawBlameRequest
,
)
...
...
@@ -813,3 +814,28 @@
do_rpc
(
sha0
,
b
''
)
assert
exc_info
.
value
.
code
()
==
grpc
.
StatusCode
.
INVALID_ARGUMENT
assert
'
RawBlame: empty Path
'
in
exc_info
.
value
.
details
()
def
test_list_files
(
grpc_channel
,
server_repos_root
):
grpc_stub
=
CommitServiceStub
(
grpc_channel
)
wrapper
,
grpc_repo
=
make_empty_repo
(
server_repos_root
)
sha0
=
wrapper
.
commit_file
(
'
foo
'
).
hex
()
sha1
=
wrapper
.
commit_file
(
'
bar
'
).
hex
()
sha2
=
wrapper
.
commit_file
(
'
zoo
'
).
hex
()
def
do_rpc
(
rev
):
request
=
ListFilesRequest
(
repository
=
grpc_repo
,
revision
=
rev
)
response
=
grpc_stub
.
ListFiles
(
request
)
final
=
[]
for
resp
in
response
:
final
.
extend
(
resp
.
paths
)
return
final
assert
do_rpc
(
sha0
)
==
[
b
'
foo
'
]
assert
do_rpc
(
sha1
)
==
[
b
'
bar
'
,
b
'
foo
'
]
assert
do_rpc
(
sha2
)
==
[
b
'
bar
'
,
b
'
foo
'
,
b
'
zoo
'
]
# with unknown revision
assert
do_rpc
(
b
"
23fire32
"
*
5
)
==
[]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment