Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using PostgreSQL database and other enhancements #35

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

vadz
Copy link

@vadz vadz commented Jan 9, 2022

First of all, thanks for your script, it was really great to be able to use it!

I'm submitting a PR with some changes that we've made to this useful script in order to migrate ~20000 tickets from out Trac to GitHub.

All commits here are more or less independent, so you can omit those of them that don't seem useful to you, but hopefully at least some of them (or maybe even all?) will be helpful.

kosh543 and others added 17 commits January 9, 2022 02:38
Use pg gem and use query syntax compatible with it.
Existing code was confused about whether it wanted to use the usernames
or emails and used different keys when looking up the assignee and the
comment author, fix it to always use Trac usernames which seems more
logical and avoids an unnecessary database lookup.

Also obfuscate the emails if we do use it and also include Trac
username in the string used on GitHub to allow searching by it later.
This can be useful to check that we can do everything but actually
creating the tickets correctly.
Avoid creating useless comments without any contents for the changes we
don't handle (such as those to the milestone field).
We only use the final value for the assignee and the intermediate
changes are not really interesting, but leak (unobfuscated) email
addresses.
Just map them to SHA-1s directly, GitHub will recognize them.
Trac stores changes to each field separately, but presents them as a
single change at the UI level, so do the same thing for the issues that
we create.
They're not shown in Trac (except to admins) and so can be reasonably
considered to be private, so don't show them publicly.
This is possible, i.e. there can be a row in session_attribute table
with the correct sid and empty value.
This allows to run the script for testing on the repositories without
the user accounts used in user mappings.
Importing milestones may be useful too.
This is useful to test migration of a single ticket, for example.
Checking too often is counterproductive and just results in exhausting
the request quota.
Doing it for all keywords is not a good idea as there are typically too
many of them, but it can be still worth doing it for some selected
keywords, that can now be specified in the labels config file section.
@vadz vadz force-pushed the pg-and-other-enhancements branch from 0a439f2 to a38107e Compare January 9, 2022 23:43
vadz added 2 commits January 10, 2022 00:43
This can be useful when using custom statuses, e.g. "confirmed" for the
tickets that were verified to be reproducible.
This is helpful when importing issues into an existing repository with
some existing PRs, as they take consume numbers in the same namespace as
the issues, making it impossible to preserve (all) the existing issue
numbers. Using this option it's at least possible to start importing
from some round number, e.g. 100, or 1000, so that the old ticket N is
now mapped to 100+N or 1000+N.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants