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

Trac wiki migration, improve markup conversion code #18

Closed
soehms opened this issue Nov 21, 2022 · 66 comments · Fixed by #34, #39, #41, #46 or #50
Closed

Trac wiki migration, improve markup conversion code #18

soehms opened this issue Nov 21, 2022 · 66 comments · Fixed by #34, #39, #41, #46 or #50

Comments

@soehms
Copy link
Member

soehms commented Nov 21, 2022

A. According to the sage-devel thread of the same title, the following tasks must be completed:

B. Tasks to be performed manually after wiki migration:

    • Replace explanations and references to the Trac wiki syntax with explanations and references to the GitHub wiki syntax.
      Examples: Reporting a bug

C. Tasks to be done after successful ticket migration:

    • Remove the link to the Trac ticket so that they point to the corresponding GitHub issue.
    • Replace requests to the Trac database with requests to GitHub issues (where possible). But maybe it's better to keep the queries on Trac and add corresponding queries on GitHub.
    • Find analogues to Trac macros and insert them at the corresponding hints produced be the script in the new GitHub wiki.
@soehms
Copy link
Member Author

soehms commented Nov 21, 2022

Remarks

Concerning A. 3.

The script doesn't recognize headings that have an anchor (#legacy-account-request) in the definition. Should we just ignore these anchors? Apparently, GitHub Markdown defines anchors automatically to each heading. A link to the above anchor would look like [#legacy-account-request Legacy sage-trac Account Request] in the Trac wiki (but in this case it is not even used) and would work as [Legacy sage-trac Account Request](#legacy-account-request) in GitHub Markdown, as well. So it should be sufficient to implement the latter conversion.

Concerning A. 4.

Unfortunately Trac uses the syntax [[Name]] with two meanings. The first meaning is a relative link in the wiki. The second meaning is a macro that implements a plugin to the wiki page. The PageOutline macro creates the table of contents plugin for the current page. It seems that the only way to distinguish between these two meanings is to check the name against a corresponding list, which must be created before starting the migration.

The next question is: what to do with the macros? Do you just ignore? Or do they have useful replacements in GitHub? Perhaps we can turn them into links to the appropriate Trac documentation for now.

Concerning A. 6.

This is caused by the following line in trac2markdown of migration.py:

        if not line.startswith('    '):

I have no idea about the purpose of this line. Removing it would fix 6 and the second example of item 4. Furthermore, the lines

    text = re.sub(r'^             * ', r'****', text)
    text = re.sub(r'^         * ', r'***', text)
    text = re.sub(r'^     * ', r'**', text)
    text = re.sub(r'^ * ', r'*', text)

don't seem to make any changes:

>>> text
'abs_integrate`-related errors (see #12731 for possibly disabling or raising warning always with it)\n     * #13097 - integral of ln(1+4/5*sin(x))\n     * #11590 - `sgn()` fu'
>>> re.sub(r'^     * ', r'**', text3)
'abs_integrate`-related errors (see #12731 for possibly disabling or raising warning always with it)\n     * #13097 - integral of ln(1+4/5*sin(x))\n     * #11590 - `sgn()` fu'

If it were, the result would be even worse since "**" is not Markdown syntax for nested bullets. Does anyone have any idea what the purpose of these lines could be? I tend to remove them as well as they just create confusion.

Concerning A. 8.

This is due to the boolean multilines passed as True to the trac2markdown function when called from convert_wiki. Setting this boolean to False fixes the problem.

Concerning B. 1.

There is a lot of text explaining the functionality of the Trac syntax. Do we want to migrate that too? A lot of wiki pages are all about that (I think most pages that have Trac or Wiki in their names). For example there are a couple of WikiProzessors that are not just syntax highlighting and that have no equivalent in Markdown (e.g. #!td, see also the macros mentioned concerning 4).

@kwankyu
Copy link

kwankyu commented Dec 1, 2022

Where is the final destination of the migrated wiki? That is, what is the repository that the migrated wiki will be placed?

Unlike migration of trac tickets, I think we can migrate trac wiki pages one by one, so that we fix some broken things manually on the migrated wiki pages, instead of perfecting the migration script and make one shot migration. Perhaps we should do both (fixing manually and improving the script).

If the plan is to keep trac running in read-only mode, then we may do the wiki migration gradually, independent of trac tickets migration.

What is the plan?

@kwankyu
Copy link

kwankyu commented Dec 1, 2022

I guess the final destigation is sage.wiki. Who will have the write permission to the wiki? As a wiki, every developer should have the write permission. Is this possible?

@soehms
Copy link
Member Author

soehms commented Dec 2, 2022

Where is the final destination of the migrated wiki? That is, what is the repository that the migrated wiki will be placed?

I assume it to be https://github.com/sagemath/sage/wiki.

... Perhaps we should do both (fixing manually and improving the script).

Yes, I think so. Improving the script helps also for the ticket migration since surely there are references to wiki pages using all possible syntax variations, as well.

What is the plan?

From the migration document it is not completely clear. I think, we should consider the Wiki migration as a test case for the ticket migration and thus it should be completed before. For the procedure of the Wiki migration I have the following in mind:

  1. Improve the script as long as there are obvious issues that can be fixed easily. Maybe we should create a list of pages that can be completely skipped. For example all pages that explain Trac functionality (having Trac or Wiki in their names).
  2. Run the migration and merge the result into https://github.com/sagemath/trac_to_gh/wiki
  3. Let the community check the result.
  4. If there are still issues to be fixed generically go back to 1.
  5. Do the remaining things manually. At least with respect of item B.1. there is still a good deal of manual work left to replace Trac-functionality specific explanations with appropriate links to the GitHub markdown documentation.
  6. Let the community check the result again.
  7. If there are still issues to be fixed manually go back to 5.
  8. Move the result to it's final destination.

After that ticket migration might happen into an appropriate temporary repository at which the community can have a look at it. An iteration similar to 1.-4. can follow.

@soehms
Copy link
Member Author

soehms commented Dec 2, 2022

I guess the final destigation is sage.wiki. Who will have the write permission to the wiki? As a wiki, every developer should have the write permission.

In principal I agree! On the other hand reviews would improve the quality (but consumes resources).

Is this possible?

See this page.

@kwankyu
Copy link

kwankyu commented Dec 2, 2022

Thanks. All you said sounds reasonable.

Are all the items in A of your first comment "obvious issues that can be fixed easily"? Or any of them is hard to fix but should be implemented because we cannot do it manually (that is hard to do manually)?

@soehms
Copy link
Member Author

soehms commented Dec 2, 2022

Are all the items in A of your first comment "obvious issues that can be fixed easily"? Or any of them is hard to fix but should be implemented because we cannot do it manually (that is hard to do manually)?

I think the hardest are done ore addressed, now. What remains are issues caused be some unreasonable lines of code. Deactivating these lines wil fix them. It's just a matter of understanding the purpose of them (see the corresponding remarks in the second comment).

@kwankyu
Copy link

kwankyu commented Dec 2, 2022

Okay. I will see if I can help you with some easy items.

@kwankyu
Copy link

kwankyu commented Dec 2, 2022

I am working on A.9. You want to convert, for instance, https://trac.sagemath.org/ticket/25206 to #25206. Right? And these #... will be converted to github issues later. Right?

kwankyu added a commit to kwankyu/trac-to-github that referenced this issue Dec 2, 2022
@kwankyu
Copy link

kwankyu commented Dec 2, 2022

I worry that my intervention may make things screwed up. Just let me know when you need a hand on any item.

@soehms
Copy link
Member Author

soehms commented Dec 3, 2022

I am working on A.9. You want to convert, for instance, https://trac.sagemath.org/ticket/25206 to #25206. Right? And these #... will be converted to github issues later. Right?

Both answers: Yes!

@soehms
Copy link
Member Author

soehms commented Dec 3, 2022

I worry that my intervention may make things screwed up. Just let me know when you need a hand on any item.

No problem! That can be treated in the PRs. The more people involved the better.

kwankyu added a commit to kwankyu/trac-to-github that referenced this issue Dec 3, 2022
soehms added a commit to soehms/trac-to-github that referenced this issue Dec 6, 2022
@soehms
Copy link
Member Author

soehms commented Dec 8, 2022

All issues known to me are done or addressed, now!

@kwankyu
Copy link

kwankyu commented Dec 9, 2022

Great! It looks almost perfect. I looked through all topics, and found the following glitches. Some may need fixing the script and other may need manual edits.

(Open the links in a new tab to see the highlighted text. Clicking the github link does not work for me.)

E. Need more edits

mkoeppe added a commit that referenced this issue Dec 9, 2022
Fix for items 4 and 7 and completion of item 5 of issue #18
mkoeppe added a commit that referenced this issue Dec 9, 2022
mkoeppe added a commit that referenced this issue Dec 9, 2022
@mkoeppe
Copy link

mkoeppe commented Dec 9, 2022

Thanks a lot for #19, #21, #23! These are great improvements.

@mkoeppe
Copy link

mkoeppe commented Dec 9, 2022

https://github.com/sagemath/trac_to_gh/wiki/sage-9.6#cylp has two links where the conversion did not work right.

@mkoeppe
Copy link

mkoeppe commented Dec 9, 2022

@mkoeppe
Copy link

mkoeppe commented Dec 9, 2022

What is the plan?

As soon as we are happy with the quality of the migration of the wiki, we can do a test migration of Trac tickets as well and see if more work on the markup translation is necessary.

Doing the actual final migration and switchover of the Trac wiki is not urgent.

@kwankyu
Copy link

kwankyu commented Dec 10, 2022

Doing the actual final migration and switchover of the Trac wiki is not urgent.

Okay. Would the final migration of wiki occur well before the migration of tickets or at the same time? I think there's no problem in doing the wiki migration separately from the tickets migration.

@mkoeppe
Copy link

mkoeppe commented Dec 10, 2022

I agree, the two migrations can be done separately.

kwankyu added a commit to kwankyu/trac-to-github that referenced this issue Dec 11, 2022
@kwankyu
Copy link

kwankyu commented Dec 11, 2022

https://github.com/sagemath/trac_to_gh/wiki/sage-9.6#cylp has two links where the conversion did not work right.

Fixed in trac side.

@mkoeppe
Copy link

mkoeppe commented Dec 24, 2022

The script needs a patched version of PyGithub now; use pip install -r requirements.txt

@kwankyu
Copy link

kwankyu commented Dec 24, 2022

I needed to remove trac_cache directory after that.

@mkoeppe
Copy link

mkoeppe commented Dec 25, 2022

Thanks very much for fixing this! Looking great

@mkoeppe
Copy link

mkoeppe commented Dec 25, 2022

the issue number "26574" does not match with the actual trac ticket number "26811"

https://trac.sagemath.org/ticket/26811

Is this a bug of the script?

Fixed in f9a937d; see for example https://github.com/sagemath/trac_to_gh/blob/main/Issues-26xxx/26811.md

@kwankyu
Copy link

kwankyu commented Dec 25, 2022

Thanks. Very nice to look around and check converted issues.

@kwankyu
Copy link

kwankyu commented Dec 25, 2022

We may name md files with 5 digit number so that they are listed in order.

@kwankyu
Copy link

kwankyu commented Dec 25, 2022

We may name md files with 5 digit number so that they are listed in order.

Perhaps not. This inconvenience applies only to issues 00xxx.

@mkoeppe
Copy link

mkoeppe commented Dec 26, 2022

Many converted tickets have the text "Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:" but then no commits are listed. What's going on there?
Compare https://trac.sagemath.org/ticket/31580 with https://github.com/sagemath/trac_to_gh/blob/main/Issues-31xxx/31580.md

@kwankyu
Copy link

kwankyu commented Dec 26, 2022

I am working on this issue. Almost fixed.

@mkoeppe
Copy link

mkoeppe commented Dec 27, 2022

@mkoeppe mkoeppe reopened this Dec 27, 2022
@mkoeppe
Copy link

mkoeppe commented Dec 27, 2022

And @ quoting misbehaves within code-quotes - https://github.com/sagemath/trac_to_gh/blob/main/Issues-34xxx/34393.md#comment:16

@kwankyu
Copy link

kwankyu commented Dec 27, 2022

And @ quoting misbehaves within code-quotes - https://github.com/sagemath/trac_to_gh/blob/main/Issues-34xxx/34393.md#comment:16

I don't know why @ is converted to be quoted in the first place. Do you know?

@mkoeppe
Copy link

mkoeppe commented Dec 27, 2022

I think it's to avoid creating accidental mentions - see also #49

@mkoeppe
Copy link

mkoeppe commented Dec 27, 2022

problem with a codeblock within a bulleted list
https://github.com/sagemath/trac_to_gh/blob/main/Issues-18xxx/18231.md#comment:3

@mkoeppe mkoeppe reopened this Dec 27, 2022
@mkoeppe
Copy link

mkoeppe commented Dec 28, 2022

These are all fixed by #56, thanks a lot @kwankyu !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment