Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CodiMD export script
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
Package registry
Container 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
stgroup
misc
CodiMD export script
Commits
853f1a71
Commit
853f1a71
authored
2 years ago
by
Andreas Domanowski
Browse files
Options
Downloads
Patches
Plain Diff
Write history.json only once
parent
530ff3f5
Branches
Branches containing commit
No related tags found
1 merge request
!1
Hedgedoc import
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
export_md/codimd_export.py
+2
-2
2 additions, 2 deletions
export_md/codimd_export.py
with
2 additions
and
2 deletions
export_md/codimd_export.py
+
2
−
2
View file @
853f1a71
...
...
@@ -43,6 +43,8 @@ def export_from_codimd(instance_url, session_id, export_to):
target_dir
=
prepare_target_dir
(
export_to
)
num_ok
=
num_fail
=
0
print_block_heading
(
f
"
Accessing history and trying to fetch each document
"
)
with
open
(
Path
(
target_dir
,
f
"
history.json
"
),
mode
=
"
w
"
)
as
stream
:
json
.
dump
(
data
,
stream
)
print
(
"
Hold on, this may take a while...
"
)
for
row
in
data
[
"
history
"
]:
document_id
=
row
[
"
id
"
]
...
...
@@ -51,8 +53,6 @@ def export_from_codimd(instance_url, session_id, export_to):
contents
=
slurp
(
f
"
{
document_url
}
/download
"
,
session_id
)
with
open
(
Path
(
target_dir
,
f
"
{
document_id
}
.md
"
),
mode
=
"
wb
"
)
as
stream
:
stream
.
write
(
contents
)
with
open
(
Path
(
target_dir
,
f
"
history.json
"
),
mode
=
"
w
"
)
as
stream
:
json
.
dump
(
data
,
stream
)
num_ok
+=
1
except
HTTPError
as
error
:
# history might reference deleted or otherwise inaccessible notes
...
...
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