chevah / trac-to-github

Hacks used to migrate from Trac sqlite to GitHub
MIT License
1 stars 0 forks source link

trac-to-github

Hacks used to migrate from Trac sqlite or Postgresql dump to GitHub.

Works with Python 3.8.

Wiki migration

For wiki migration, you will need git available in your dev environment.

This is a 3 stage process:

  1. Copy config.py.sample over config.py, and edit all the settings.

  2. Create the GitHub Wiki pages using content formated as TracWiki. This is done to have better diffs between historic versions.

  3. Convert the last version of the each page to ReStructuredText, or to any other format.

Convert to git repo

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>`_

Convert the content to RST

For wiki content conversion::

python wiki_trac_rst_convert.py PATH/TO/GIT-REPO

Things that are not yet auto-converted:

Ticket migration

The script to use is ticket_migrate_golden_comet_preview.py.

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.