bgamari / trac-to-remarkup

Moved to GitLab: https://gitlab.haskell.org/bgamari/trac-to-remarkup
https://gitlab.haskell.org
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Commit comments should not be imported #5

Closed mpickering closed 5 years ago

mpickering commented 5 years ago

There are lots of redundant automatic comments which were posted on trac whenever a commit mentions a ticket number. These should instead be converted into proper links from the commit to the ticket and the comments removed.

For example:

https://gitlab.staging.haskell.org/ghc/ghc/issues/13545#note_111375

I wrote some code previously to identify which commits these were:

https://github.com/danpalmer/trac-to-phabricator/blob/e9071c8b49a33c521bc891d531c700c6206c1461/src/Trac.hs#L285

As a result, many useless user accounts are created.

https://gitlab.staging.haskell.org/ghc/ghc/project_members?utf8=%E2%9C%93&search=pickering

tdammers commented 5 years ago

OK, so simply skipping commit comments entirely should do the trick, no?

mpickering commented 5 years ago

You have to be careful as there might be comment references which point to commit comments.

Your change will also still post a comment but it will be empty.. and a bad account will be created still for the email author.

tdammers commented 5 years ago

See my inline comment - no, it shouldn't create a comment, unless the commit additionally leads to a metadata change that's reflected in the "trac metadata" table.

tdammers commented 5 years ago

OK, so it turns out we actually do need to generate links to commits, because people did in fact do this in Trac. I think the way to do this would be to extend the comment cache to hold either a note ID or a commit hash, and then in the link renderer, render an appropriate link.

bgamari commented 5 years ago

Tobias Dammers notifications@github.com writes:

OK, so it turns out we actually do need to generate links to commits, because people did in fact do this in Trac. I think the way to do this would be to extend the comment cache to hold either a note ID or a commit hash, and then in the link renderer, render an appropriate link.

Sounds right to me.

tdammers commented 5 years ago

Oof, getting the commit hash out of those commit comments was quite an effort, but I got it working. Now to extend the comment cache data structure...

tdammers commented 5 years ago

Hmm, or alternatively, we could generate a note after all, but synthesize a note text that merely contains a link to the commit.

I don't know whether gitlab is supposed to show issue mentionings in git commits; I've imported the entire GHC repo into my gitlab instance, but it doesn't seem to pick anything up. If commit mentions don't show up in an issue feed, then maybe adding those notes might be useful; otherwise I'd vote to just link directly to commits.