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

User profile commits stat not working #1744

Open
sarahboyce opened this issue Nov 18, 2024 · 4 comments
Open

User profile commits stat not working #1744

sarahboyce opened this issue Nov 18, 2024 · 4 comments
Labels

Comments

@sarahboyce
Copy link
Contributor

The commits stat in the user profile is not displayed as it's always 0

Options are:

  • fix the query
  • use the GitHub api to count commits
  • remove the stat
@sarahboyce sarahboyce added the bug label Nov 18, 2024
@bmispelon
Copy link
Member

I went to take a peek at the actual Revision database, here are the latest 50 rows:

                   rev                    |                           author                           
------------------------------------------+------------------------------------------------------------
 4c452cc377f6f43acd90c6e54826ebd2e6219b0d | GitHub <noreply@github.com>
 9543c605c38b80b3ace3836b110e9e1938a44a97 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 08ac8c1b4416d1fba39f86dd328017ca74abce67 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 17e544ece7e51c5eaeff9bdadc3de263fdd98dee | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 4c65aecfe7ebebf2c90f2cccb6d240cd14c1445c | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c56e1273a9d87ffad3a84fb597550f79b9820281 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 8d7b1423f89bcc3df57333fc79fa5aead17b0cbc | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 3434fab758c5a293c8f376bb5990af6acbf89e32 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 e035db1bc3bbeb4282a177ad106add3b07d97b09 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 1be9c5fb56febbf63072c81f61664f25b6c16bc0 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 ca113adbae1cc2129256f51ac71e8aed2a381576 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 9609b48b9149aa0b96208588b99ce6161be6a287 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 2debd018dbc7aba0b98b4c082bbb1fa1d195a47e | GitHub <noreply@github.com>
 037e740ec56674e69e564b97e1151950757c410d | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 91c879eda595c12477bbfa6f51115e88b75ddf88 | GitHub <noreply@github.com>
 8590d05d44a4f3df56d988229e43d66c37df79da | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 a2bc2925b1edbab3d68689d19dd0d09f41638a4d | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 0c2c33bc87beb26afd988c19a08e669c92bc41c6 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 512a2bad0574a3748cb2f141a761a286a67f0ae9 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 da2432cccae841f0d7629f17a5d79ec47ed7b7cb | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c387d86882817fe007e1b217e9f6bc62ff513693 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 e519b335a5373338c576553b94a4b5fcbaf96e1b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 7e759d9af714b4db6735f7e53f62a5933a6260b8 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 56ffd9f20a98a486b817b0d1dc5ccbe6a557a965 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 4c5455d25ccd3b6227c8f3e58406b12a1fb703c7 | Natalia <124304+nessita@users.noreply.github.com>
 299b072498b23d1d7fe9f1545f7b27b73ca8e22b | GitHub <noreply@github.com>
 b9aa3239ab1328c915684d89b87a49459cabd30b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c12bc980e5b2bb25e447cd8dee550cad767f1ad2 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 ef8ae06c2acd7b3673fee15b379213169153c7b0 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c4614b53d355561d426b0fed903e96c3c198e10d | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 d71c588d83e58e83bdd9ea8bf03724d10f02a8bd | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 4c079918e853c4e6ddfc4bd52e87992f7281094b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 63dbe30d3363715deaf280214d75b03f6d65a571 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 54774e790d461d94653a4a83a7f5cc456e6d246a | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 fdca036827b7059c9915680da490ef3520f720fc | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 398cec434bc9359529fea141d22742d71ed25d41 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 2bc43ccbdb28b9d87da172ef119ff3b48e6ff71a | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 6f32087a09f34cffdd77ad7de6b7fc2c9e59712b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 46eb256ccedcac6b1f6bc957461506d881d468fb | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 ae5743d461ee30c6241c8bb207b98039aaa6255b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 40bfd7b09aa0907b143e96f0b055538f476e544e | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 042b381e2e37c0c37b8a8f6cc9947f1a2ebfa0dd | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 41da8a4f5a55c11fb28d2a172a7ad2cff53ca9ec | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 661dfdd59809f4abd5077f7a2529735d07b98ba4 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 08c0c421394048a0f4c367bc1798ee5d332c5b62 | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c4c076223eb73553d3bc8fbc11be2c529d9aea6b | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 c2c544cf01107da158cb8c0c539555eafa0628db | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 78c9a2703151432f8e35cb63fca5a566fee5f8ed | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 fe12428cb958b49a7cd76a6271b32eceb4ffcffa | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
 18b3a9dd395278232354a4f2507660a4f849c6eb | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>

Seems like something is wrong with the way we insert commits in the database (which I think is done via the trac-github plugin).

If we could fix that, then option 1 would be my preferred approach.

@sarahboyce
Copy link
Contributor Author

It looks like 2 issues, there's the patch author and then the commiter/merger but also the git commit author and your GitHub/Trac username don't match 🤔 might be fiddly

@bmispelon
Copy link
Member

I did some digging in the Trac source code (don't worry, I was wearing the appropriate safety equipment 🦺 ).

Turns out this is a Trac "feature": https://github.com/edgewall/trac/blob/4e4d0529870bee221c6a4eb0861265487a630ec0/tracopt/versioncontrol/git/git_fs.py#L330-L333
By default, Trac will record the committer and not the author, which is exactly the opposite of what we want 🤪

Fixing this should be a oneline config change (PR incoming), but that will only take care of new commits. It should be possible to write a kind of migration to go fix things retroactively (I think Trac has a migration system but it seemed clunky to use the last time I briefly checked).

@bmispelon
Copy link
Member

Small followup: it turns out it's fairly easy to retroactively fix the revisions in the database by running trac-admin trac-env repository resync '*' after making the config change. The command takes a while (it has to process ~40k commits one by one) but when it's done the revision table has the correct authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants