Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-vault
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Platform
Development
swh-vault
Commits
27d466e5
Commit
27d466e5
authored
2 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
Fix mypy warning about untyped methods
parent
da0ec08c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!181
Fix a whole bunch of warnings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/vault/cookers/git_bare.py
+8
-7
8 additions, 7 deletions
swh/vault/cookers/git_bare.py
with
8 additions
and
7 deletions
swh/vault/cookers/git_bare.py
+
8
−
7
View file @
27d466e5
...
...
@@ -131,7 +131,7 @@ class GitBareCooker(BaseVaultCooker):
stack
[
-
n
:]
=
[]
return
obj_ids
def
prepare_bundle
(
self
):
def
prepare_bundle
(
self
)
->
None
:
"""
Main entry point. Initializes the state, creates the bundle, and
sends it to the backend.
"""
# Objects we will visit soon (aka. "todo-lists"):
...
...
@@ -145,7 +145,7 @@ class GitBareCooker(BaseVaultCooker):
self
.
_walker_state
:
Optional
[
Any
]
=
None
# Set of errors we expect git-fsck to raise at the end:
self
.
_expected_fsck_errors
=
set
()
self
.
_expected_fsck_errors
:
Set
[
str
]
=
set
()
with
tempfile
.
TemporaryDirectory
(
prefix
=
"
swh-vault-gitbare-
"
)
as
workdir
:
# Initialize a Git directory
...
...
@@ -264,20 +264,21 @@ class GitBareCooker(BaseVaultCooker):
return
revision
.
id
def
write_refs
(
self
,
snapshot
=
None
):
def
write_refs
(
self
,
snapshot
=
None
)
->
None
:
"""
Writes all files in :file:`.git/refs/`.
For non-snapshot objects, this is only ``master``.
"""
refs
:
Dict
[
bytes
,
bytes
]
# ref name -> target
if
self
.
obj_type
==
RootObjectType
.
DIRECTORY
:
if
self
.
obj_type
is
RootObjectType
.
DIRECTORY
:
# We need a synthetic revision pointing to the directory
rev_id
=
self
.
_make_stub_directory_revision
(
self
.
obj_id
)
refs
=
{
b
"
refs/heads/master
"
:
hash_to_bytehex
(
rev_id
)}
elif
self
.
obj_type
==
RootObjectType
.
REVISION
:
elif
self
.
obj_type
is
RootObjectType
.
REVISION
:
refs
=
{
b
"
refs/heads/master
"
:
hash_to_bytehex
(
self
.
obj_id
)}
elif
self
.
obj_type
==
RootObjectType
.
RELEASE
:
elif
self
.
obj_type
is
RootObjectType
.
RELEASE
:
(
release
,)
=
self
.
storage
.
release_get
([
self
.
obj_id
])
assert
release
,
self
.
obj_id
if
release
.
name
and
re
.
match
(
rb
"
^[a-zA-Z0-9_.-]+$
"
,
release
.
name
):
release_name
=
release
.
name
...
...
@@ -293,7 +294,7 @@ class GitBareCooker(BaseVaultCooker):
refs
[
b
"
ref/heads/master
"
]
=
hash_to_bytehex
(
release
.
target
)
# TODO: synthesize a master branch for other target types
elif
self
.
obj_type
==
RootObjectType
.
SNAPSHOT
:
elif
self
.
obj_type
is
RootObjectType
.
SNAPSHOT
:
if
snapshot
is
None
:
# refs were already written in a previous step
return
...
...
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