Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-loader-mercurial
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Antoine R. Dumont
swh-loader-mercurial
Commits
dbb12fdb
Commit
dbb12fdb
authored
3 years ago
by
Raphaël Gomès
Browse files
Options
Downloads
Patches
Plain Diff
new-loader: save ExtID for each revision
... instead of doing it in bulk at the end.
parent
e666b0dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/loader/mercurial/from_disk.py
+8
-13
8 additions, 13 deletions
swh/loader/mercurial/from_disk.py
with
8 additions
and
13 deletions
swh/loader/mercurial/from_disk.py
+
8
−
13
View file @
dbb12fdb
...
...
@@ -353,8 +353,6 @@ class HgLoaderFromDisk(BaseLoader):
target_type
=
TargetType
.
RELEASE
,
)
extids
=
[]
for
hg_nodeid
,
revision_sha1git
in
self
.
_revision_nodeid_to_sha1git
.
items
():
if
hg_nodeid
in
branch_by_hg_nodeid
:
name
=
branch_by_hg_nodeid
[
hg_nodeid
]
...
...
@@ -369,20 +367,9 @@ class HgLoaderFromDisk(BaseLoader):
target
=
name
,
target_type
=
TargetType
.
ALIAS
,
)
if
hg_nodeid
not
in
self
.
_latest_heads
:
revision_swhid
=
identifiers
.
CoreSWHID
(
object_type
=
identifiers
.
ObjectType
.
REVISION
,
object_id
=
revision_sha1git
,
)
extids
.
append
(
ExtID
(
extid_type
=
EXTID_TYPE
,
extid
=
hg_nodeid
,
target
=
revision_swhid
)
)
snapshot
=
Snapshot
(
branches
=
snapshot_branches
)
self
.
storage
.
snapshot_add
([
snapshot
])
self
.
storage
.
extid_add
(
extids
)
self
.
flush
()
self
.
loaded_snapshot_id
=
snapshot
.
id
...
...
@@ -499,6 +486,14 @@ class HgLoaderFromDisk(BaseLoader):
self
.
_revision_nodeid_to_sha1git
[
hg_nodeid
]
=
revision
.
id
self
.
storage
.
revision_add
([
revision
])
# Save the mapping from SWHID to hg id
revision_swhid
=
identifiers
.
CoreSWHID
(
object_type
=
identifiers
.
ObjectType
.
REVISION
,
object_id
=
revision
.
id
,
)
self
.
storage
.
extid_add
(
[
ExtID
(
extid_type
=
EXTID_TYPE
,
extid
=
hg_nodeid
,
target
=
revision_swhid
)]
)
def
store_release
(
self
,
name
:
bytes
,
target
:
Sha1Git
)
->
Sha1Git
:
"""
Store a release given its name and its target.
...
...
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