Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

graphqlbackend: Add perforce changelist related properties#52937

Merged
indradhanush merged 12 commits into
mainfrom
ig/repo-commits-changelists-gql-api
Jun 13, 2023
Merged

graphqlbackend: Add perforce changelist related properties#52937
indradhanush merged 12 commits into
mainfrom
ig/repo-commits-changelists-gql-api

Conversation

@indradhanush

@indradhanush indradhanush commented Jun 5, 2023

Copy link
Copy Markdown
Contributor

Part of #40330.

What

In this PR we add two GraphQL API changes:

  • The Repository node can now support querying changelists by changelist ID similar to the commits API
  • The PerforceChangelist node has two new properties:
    1. canonicalURL - similar to the GitCommit node but uses /changelist/<cid>
    2. commit - the corresponding GitCommit from the repo

Why

In the UI we want to be able to lookup a changelist by ID and display all properties from the corresponding git commit

Test plan

  • Tested manually
  • Added tests
  • Tested with UI changes (separate PR)

@cla-bot cla-bot Bot added the cla-signed label Jun 5, 2023
Comment thread cmd/frontend/graphqlbackend/git_commit_test.go Outdated
Comment thread cmd/frontend/graphqlbackend/git_commit_test.go Outdated
Comment thread cmd/frontend/graphqlbackend/git_commit_test.go Outdated
Comment thread cmd/frontend/graphqlbackend/git_commit_test.go Outdated
Comment thread cmd/frontend/graphqlbackend/git_commit_test.go Outdated
Comment thread cmd/frontend/graphqlbackend/perforce_changelist.go Outdated
@indradhanush indradhanush requested a review from stefanhengl June 5, 2023 15:05
Comment thread cmd/frontend/graphqlbackend/perforce_changelist_test.go Outdated
@indradhanush indradhanush changed the title graphqlbackend: Add canonicalURL to perforceChangelist graphqlbackend: Add canonicalURL to perforceChangelist and add changelist to repository node Jun 6, 2023
Comment on lines 735 to 736

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous value was using the repo ID as 0 since the repos.GetByNameFunc was always returning nil. Updating this now returns repo ID as 2 which is the correct value.

Same for below.

@indradhanush indradhanush force-pushed the ig/repo-commits-changelists-gql-api branch from 83fc81d to 31268ab Compare June 6, 2023 09:53
@indradhanush indradhanush force-pushed the ig/repo-commits-changelists-gql-api branch 2 times, most recently from e52a2aa to 897e915 Compare June 9, 2023 14:45
@indradhanush indradhanush changed the title graphqlbackend: Add canonicalURL to perforceChangelist and add changelist to repository node graphqlbackend: Add perforce changelist related properties Jun 9, 2023
@indradhanush indradhanush marked this pull request as ready for review June 9, 2023 15:43
@indradhanush indradhanush requested a review from a team June 9, 2023 15:43
@indradhanush indradhanush self-assigned this Jun 9, 2023
@indradhanush indradhanush added perforce graphqlbackend perforce-changelists Issues around Changelist Ids for Perforce depots labels Jun 9, 2023
@sourcegraph-bot

sourcegraph-bot commented Jun 9, 2023

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@pjlast pjlast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm from a bit of an ignorant point of view when it comes to Perforce changelists

Comment thread cmd/frontend/graphqlbackend/perforce_changelist.go Outdated
@indradhanush indradhanush force-pushed the ig/repo-commits-changelists-gql-api branch from 74ccd94 to 232cf3f Compare June 13, 2023 13:18
@indradhanush

Copy link
Copy Markdown
Contributor Author

Rebased off latest main because backcompat tests were failing.

@indradhanush indradhanush enabled auto-merge (squash) June 13, 2023 13:43
@indradhanush indradhanush merged commit 9ec4830 into main Jun 13, 2023
@indradhanush indradhanush deleted the ig/repo-commits-changelists-gql-api branch June 13, 2023 13:56
ErikaRS pushed a commit that referenced this pull request Jun 22, 2023
## What

In this PR we add two GraphQL API changes:

- The `Repository` node can now support querying `changelists` by
changelist ID similar to the `commits` API
- The `PerforceChangelist` node has two new properties:
1. `canonicalURL` - similar to the `GitCommit` node but uses
`/changelist/<cid>`
    2. `commit` - the corresponding `GitCommit` from the repo

## Why

In the UI we want to be able to lookup a changelist by ID and display
all properties from the corresponding git commit
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed perforce perforce-changelists Issues around Changelist Ids for Perforce depots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants