Hacks used to migrate from Trac sqlite or Postgresql dump to GitHub.
Works with Python 3.8.
For wiki migration, you will need git available in your dev environment.
This is a 3 stage process:
Copy config.py.sample
over config.py
, and edit all the settings.
Create the GitHub Wiki pages using content formated as TracWiki. This is done to have better diffs between historic versions.
Convert the last version of the each page to ReStructuredText, or to any other format.
Create a virtualenv::
virtualenv build
. build/bin/activate
mv config.py.sample config.py
Modify the config.py values.
All pages are generated into a flat file structure. Spaces are used instead of path separators::
python wiki_migrate.py PATH/TO/Trac.db3 PATH/TO/GIT-REPO
You might want to add a _Sidebar.rst
file in the root with::
* `<Administrative>`_
* `<Development>`_
* `<Infrastructure>`_
* `Services <Infrastructure-Services>`_
* `Machines <Infrastructure-Machines>`_
* `<Support>`_
For wiki content conversion::
python wiki_trac_rst_convert.py PATH/TO/GIT-REPO
Things that are not yet auto-converted:
=== Some sub-section ===
[[TitleIndex(Development/)]]
[[PageOutline]]
The script to use is ticket_migrate_golden_comet_preview.py
.
config.py.sample
to config.py
, and edit all the settings.
Perhaps use a fake OAUTH_TOKEN
to avoid accidental changes.postgres-to-sqlite.sh
.
date -I
.shdate -I
.sh # Will take ~1 minute for ~10k tickets.date -I
.sqlite3 # About 70M for 10346 ticketstouch tickets_created.tsv && touch tickets_expected_gold.tsv && touch milestones_created
select_tickets
to your liking.
Perform a dry run, generating tickets_expected.tsv
.tickets_expected.tsv
,
copy it as tickets_expected_gold.tsv
,
to check against tickets_expected.tsv
generated by future runs.tickets_expected_gold.tsv
.DRY_RUN
to False
in ticket_migrate_golden_comet_preview.py
.python -u ./ticket_migrate_golden_comet_preview.py ../trac.db | tee -a output.txt
, where ../trac.db
is the path
to the Trac SQLite DB dump.milestones_created.tsv
.tickets_expected.tsv
must match tickets_expected_gold.tsv
.c
at the debugger.In the event a new ticket or PR is created while the script is running,
you must manually add a fake entry to tickets_created.tsv
so that,
on retrying, as much as possible of tickets_expected.tsv
still matches
tickets_expected_gold.tsv
.
But you must manually fix any references to that GitHub ID.