Skip to content

Commit

Permalink
Use flat dirs for export.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban authored and danuker committed Jan 26, 2021
1 parent 09775ab commit 316a93d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ You might want to add a `_Sidebar.rst` file in the root wit::
* `<Infrastructure>`_
* `<Support>`_

For wiki content convertion::
For wiki content conversion::

python wiki_trac_rst_convert.py PATH/TO/GIT-REPO
26 changes: 1 addition & 25 deletions wiki_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def main():

print("Adding", name)

create_dirs(name)
write_file(name, text)
commit_change(name, author, comment, timestamp / 1000000)

Expand All @@ -61,30 +60,7 @@ def get_page_name(name):
"""
name = PAGE_NAME_MAPPING.get(name, name)

file_name = name.replace('/', ' ') + FILE_EXTENSION

parts = name.split('/')[:-1]
dir_name = ''

if parts:
dir_name = os.path.join(*parts)

return os.path.join(dir_name, file_name)


def create_dirs(name):
"""
Create the required directories for name.
"""

parent = ''
for part in name.split('/')[:-1]:
parent = os.path.join(parent, part)
if os.path.exists(parent):
continue
os.mkdir(parent)


return name.replace('/', ' ').strip() + FILE_EXTENSION


def write_file(name, text):
Expand Down

0 comments on commit 316a93d

Please sign in to comment.