graphqlbackend: Add changelistURL to GitBlob#53605
Conversation
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 5089e69...6379006.
|
| } | ||
|
|
||
| func (r *GitTreeEntryResolver) ChangelistURL(ctx context.Context) (*string, error) { | ||
| repo := r.Repository() |
There was a problem hiding this comment.
just a sanity check: we won't fetch repo here for the second/n-th time, right?
There was a problem hiding this comment.
Nope. It returns the r.commit.repoResolver which is already set as a backlink in the GitTreeEntryResolver which is set when the resolver is initialised.
Good check though!
| } | ||
|
|
||
| func (r *PerforceChangelistResolver) cidURL() *url.URL { | ||
| // Do not mutate the URL on the RepoMatch object. |
There was a problem hiding this comment.
I think this comment may be misleading since RepoMatch doesn't contain the URL itself, it is constructed from other properties and returned as a new object which we can totally mutate.
There was a problem hiding this comment.
Ah - I agree. I will fix in a follow up. Going ahead with the merge because branch cut in ~8 mins. :P
…st view page (#53668) Stacked on #53605. Part of #40330. ## Test plan 🎥 https://www.loom.com/share/a516e86ffc4341f7a7bfd83c1808c7bd?sid=d6d1d5fe-5842-458e-8078-4fb3d4e9d0c1 <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> <br> Backport 65345a7 from #53608 Co-authored-by: Indradhanush Gupta <indradhanush.gupta@gmail.com>
Part of #40330. ## Why We want to be able to generate permalinks for files in a perforce depot ## What - Add the `changelistURL` property to the `File2` interface - Add the `changelistURL` property to all the types that implement the `File2` interface - Implement the `ChangelistURL` API and return a changelist URL for the `GitBlob` type - Return nil for all the other types that implement `File2` (existing behaviour for these types, for example `url` is also not implemented on them) Following existing conventions. Ideally we should have a top level `urls` node that embeds all the different type of urls instead of having them on the top level definition in the `File2` interface, but that is a major API change that we're not ready for
Part of #40330.
Why
We want to be able to generate permalinks for files in a perforce depot
What
changelistURLproperty to theFile2interfacechangelistURLproperty to all the types that implement theFile2interfaceChangelistURLAPI and return a changelist URL for theGitBlobtypeFile2(existing behaviour for these types, for exampleurlis also not implemented on them)Following existing conventions. Ideally we should have a top level
urlsnode that embeds all the different type of urls instead of having them on the top level definition in theFile2interface, but that is a major API change that we're not ready forTest plan