perforce: Display changelists in repo and view commits page#51195
Conversation
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits 32aa12d and 86a234d or learn more. Open explanation
|
There was a problem hiding this comment.
Return the commit SHA instead of failed to parse for now. Create a GitHub issue to track this for the future. - @peterguy
There was a problem hiding this comment.
TODO: Test a changelist with multiple depot-paths and verify that this pattern still works for it if that's the case.
c72cefb to
c515764
Compare
|
@keegancsmith Requesting review for the minimal but important backend API changes. |
sashaostrikov
left a comment
There was a problem hiding this comment.
Amazing job!
Love the storybook coverage and backend tests 👍🏻
I agree with Peter's note about another UI view which should be covered with commit/changeset duality :)
Left some comments, PTAL.
| return &repoUrl | ||
| } | ||
|
|
||
| var p4FusionCommitSubjectPattern = regexp.MustCompile(`^(\d+) - (.*)$`) |
There was a problem hiding this comment.
should we use a lazyregexp here and on L492?
There was a problem hiding this comment.
Hmm. TIL about lazyregexp. I think I prefer using regexp.MustCompile because it will guarantee an invalid regex can never be compiled, which I think is missing with lazyregexp.
There was a problem hiding this comment.
Let's use lazyregexp for its benefit of being lazy and cover the validity by a unit test (which will fail in case of an invalid regex being used). Anyway, the regex is static and once it compiles during tests (during CI run) before being merged to main, we're safe in production.
WDYT?
|
@peterguy, @sashaostrikov As discussed on Slack, will be following up in a new PR with updates to the commit view page. |
|
Update: The approach of modifying the the I'm reworking the API changes, converting this to a draft and in the meantime please hold on to reviews. |
a2ca952 to
d15b441
Compare
|
@peterguy, @sashaostrikov Check this out - I reused the existing component and got rid of the code duplication. All a result of the API changes I made in #51291! How cool is that?! 😎 Also that means now the commit view page also gets these improvements! See below 👇🏽👇🏽👇🏽 The link to the parent also works, the only downside (not in scope of this work) is that the link still works through commit SHAs so you cannot:
Because the resulting page still shows up with commit SHAs. |
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff d60c0c3...32aa12d.
|
|
Removing myself since there are no go changes now. |
|
@keegancsmith Sorry about that. The Go changes have now moved to this PR: https://github.com/sourcegraph/sourcegraph/pull/51291. |
b90ebe8 to
529c8d0
Compare
sashaostrikov
left a comment
There was a problem hiding this comment.
hmm, I thought I already approved it after latest changes...
Approved now!
I need to rework this PR after the backend API changed quite a bit based on reviews in #51291. Moving this to draft for the time being. |
Co-authored-by: Milan Freml <kopancek@users.noreply.github.com>
51d722d to
77f97f4
Compare
sashaostrikov
left a comment
There was a problem hiding this comment.
Took another look! 👍🏻


What
Part of #46488. Blocked by #51291.
We want to display the perforce changelists in the repo landing page and the view commits page instead of the commit SHA because to a perforce developer looking at this code, a commit SHA is meaningless.
Description of the changes
UI changes
For perforce depots converted to git:
changelist,changelistsandchangelist IDinstead ofcommit,commitsandcommit SHArespectivelychangelistrelated terms with changelist ID instead of the commit SHA and parent commit SHAAlso fixed the typos in the word
committedacross the whole codebase as I noticed it started to fail when I made a change in the existing code.Meta UI changes
My UI skills are nascent and come with some limitations:
Instead of riddling the existingGitCommitNodecomponent with if else conditions to displaycommit/sorchangelist/s, I decided to create a new component which is pretty much a copy-paste of theGitCommitNodecomponent with changes to display perforce terms and some minor changes to tweak the CSS and deleting some lines of code which were obviously not related to Perforce (some GitHub related checks)I thought about adding an argument to theGitCommitNodeto customise the message text, but I wanted to add the least amount of friction possible to the current code in case I end up breaking something, also passingchangelistto a commitnode component felt wronggetRefType: This function returnscommitorchangelistbased on the repo type and I have two kinds of implementations in two different modulesI'm sure there are ways to do this cleaner in less lines of code and am happy to iterate on those. :)
Edit: I am reusing the
GitCommitNodecomponent. This was easy.Run
sg run storybookand check out the storybooks here:Previously
Now
Test plan