sagemath / trac-to-github

Script to migrate Trac tickets to GitHub issues and the Trac wiki to markdown. Input: https://trac.sagemath.org/ ➠ Intermediate: https://github.com/sagemath/trac_to_gh ➠ Output: https://github.com/sagemath/sage/issues
https://trac.sagemath.org/ticket/30363
7 stars 5 forks source link

Fix labels / colors after #174, #177 #178

Closed mkoeppe closed 1 year ago

mkoeppe commented 1 year ago

https://github.com/sagemath/sage/labels?page=3&sort=name-asc

Screenshot 2023-02-04 at 10 07 41 PM
mkoeppe commented 1 year ago

@kwankyu

kwankyu commented 1 year ago

I get 404 from the link. What's the problem? The labels don't get the texts we intended? It is "wontfix" instead of "r: wontfix"?

mkoeppe commented 1 year ago

The screenshot shows both prefixed and non-prefixed labels, and the r: labels have the wrong color.

mkoeppe commented 1 year ago

I think I'll just back out the most recent changes to the labels.

kwankyu commented 1 year ago

Ah, yes. I don't quite understand how labels are defined. Let me ask some questions.

(1) Could non-prefixed labels be remnants from the previous import?

(2) Are they completely defined only by migrate.cfg.sagetracmigrationarchive?

mkoeppe commented 1 year ago

(1) No, I always clean in the production environment

(2) No, there are also some default colors defined somewhere in the script

kwankyu commented 1 year ago

Then "duplicate and "r: duplicate" are both defined somewhere in our migration script?

mkoeppe commented 1 year ago

One mistake is in map_resolution, I think - there's no prefix added

mkoeppe commented 1 year ago

Maybe this would already fix the colors too, not sure.

mkoeppe commented 1 year ago

OK, I've made this change in 6c41c5d

kwankyu commented 1 year ago

If we can use GHE, which seems down now, we can experiment before proceeding...

kwankyu commented 1 year ago

Maybe this would already fix the colors too, not sure.

This might be enough.

mkoeppe commented 1 year ago

Yes, our trial license for GHE has already expired, Dima shut down the server a few days ago.

mkoeppe commented 1 year ago

Looks like this is indeed fixing it already.

kwankyu commented 1 year ago

If label_category is r: resolution, then this code

labelcolor[label_category] 

will not work since we only have resolution: c6c6c6 but not r: resolution: c6c6c6 in migrate.cfg.sagetracmigrationarchive. Is label_category still resolution?

mkoeppe commented 1 year ago

Is label_category still resolution?

It is.

kwankyu commented 1 year ago

Now I saw it. OK!

kwankyu commented 1 year ago

Do these work as intended?

milestones_to_labels = {
 'sage-duplicate/invalid/wontfix': 'r: invalid',
 'sage-duplicate/invalid': 'r: invalid',
 'sage-duplicate': 'r: duplicate',

I don't see where these labels get the correct colors.

kwankyu commented 1 year ago

If not, we need this:

diff --git a/migrate.cfg.sagetracmigrationarchive b/migrate.cfg.sagetracmigrationarchive
index 3d0ba93e07..36e60b014c 100644
--- a/migrate.cfg.sagetracmigrationarchive
+++ b/migrate.cfg.sagetracmigrationarchive
@@ -216,6 +216,8 @@ label_colors = {
  't: refactoring': '696969',
  't: feature': '696969',
  't: tests': '696969',
+ 'r: invalid': 'c6c6c6',
+ 'r: duplicate': 'c6c6c6',
  'resolution': 'c6c6c6'}

 # values to be ignored on issue conversion
mkoeppe commented 1 year ago

I have checked the output (archive/repositories_000001.json). They are correct.

mkoeppe commented 1 year ago

I think it happens to go through the map_resolution path first, and in this way the label picks up the correct color.

kwankyu commented 1 year ago

Okay then.