Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-journal
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-journal
Commits
5fec9fdd
Verified
Commit
5fec9fdd
authored
5 years ago
by
Antoine R. Dumont
Browse files
Options
Downloads
Patches
Plain Diff
journal.replay: Align _fix_content with other fix methods
parent
fbd82953
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!136
journal.replay: Align _fix_content with other fix methods
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/journal/replay.py
+12
-13
12 additions, 13 deletions
swh/journal/replay.py
with
12 additions
and
13 deletions
swh/journal/replay.py
+
12
−
13
View file @
5fec9fdd
...
...
@@ -68,21 +68,20 @@ def process_replay_objects(all_objects, *, storage):
notify
(
'
WATCHDOG=1
'
)
def
_fix_contents
(
contents
:
Iterable
[
Dict
[
str
,
Any
]])
->
Iterable
[
Dict
[
str
,
Any
]]:
def
_fix_content
(
content
:
Dict
[
str
,
Any
])
->
Dict
[
str
,
Any
]:
"""
Filters-out invalid
'
perms
'
key that leaked from swh.model.from_disk
to the journal.
>>>
list
(
_fix_contents
([
...
{
'
perms
'
:
0o100644
,
'
sha1_git
'
:
b
'
foo
'
},
...
{
'
sha1_git
'
:
b
'
bar
'
},
...
]))
[{
'
sha1_git
'
:
b
'
foo
'
},
{
'
sha1_git
'
:
b
'
bar
'
}]
>>>
_fix_content
({
'
perms
'
:
0o100644
,
'
sha1_git
'
:
b
'
foo
'
})
{
'
sha1_git
'
:
b
'
foo
'
}
>>>
_fix_content
({
'
sha1_git
'
:
b
'
bar
'
})
{
'
sha1_git
'
:
b
'
bar
'
}
"""
for
content
in
contents
:
content
=
content
.
copy
()
content
.
pop
(
'
perms
'
,
None
)
yield
content
content
=
content
.
copy
()
content
.
pop
(
'
perms
'
,
None
)
return
content
def
_fix_revision_pypi_empty_string
(
rev
):
...
...
@@ -338,8 +337,8 @@ def _insert_objects(object_type: str, objects: List[Dict], storage) -> None:
if
object_type
==
'
content
'
:
contents
:
List
[
BaseContent
]
=
[]
skipped_contents
:
List
[
BaseContent
]
=
[]
for
content
in
_fix_contents
(
objects
)
:
c
=
BaseContent
.
from_dict
(
content
)
for
content
in
objects
:
c
=
BaseContent
.
from_dict
(
_fix_
content
(
content
)
)
if
isinstance
(
c
,
SkippedContent
):
skipped_contents
.
append
(
c
)
else
:
...
...
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