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

Commit

Permalink
Remove repositoryDiffs (#12205)
Browse files Browse the repository at this point in the history
  • Loading branch information
eseliger authored and mrnugget committed Jul 20, 2020
1 parent 20a22fb commit cd50ee6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 88 deletions.
1 change: 0 additions & 1 deletion cmd/frontend/graphqlbackend/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ type CampaignResolver interface {
Changesets(ctx context.Context, args *ListChangesetsArgs) (ChangesetsConnectionResolver, error)
OpenChangesets(ctx context.Context) (ChangesetsConnectionResolver, error)
ChangesetCountsOverTime(ctx context.Context, args *ChangesetCountsArgs) ([]ChangesetCountsResolver, error)
RepositoryDiffs(ctx context.Context, args *graphqlutil.ConnectionArgs) (RepositoryComparisonConnectionResolver, error)
Status(context.Context) (BackgroundProcessStatus, error)
ClosedAt() *DateTime
DiffStat(ctx context.Context) (*DiffStat, error)
Expand Down
6 changes: 0 additions & 6 deletions cmd/frontend/graphqlbackend/repository_comparison.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ import (
"github.com/sourcegraph/sourcegraph/internal/vcs/git"
)

type RepositoryComparisonConnectionResolver interface {
Nodes(ctx context.Context) ([]*RepositoryComparisonResolver, error)
TotalCount(ctx context.Context) (int32, error)
PageInfo(ctx context.Context) (*graphqlutil.PageInfo, error)
}

type RepositoryComparisonInput struct {
Base *string
Head *string
Expand Down
16 changes: 0 additions & 16 deletions cmd/frontend/graphqlbackend/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions cmd/frontend/graphqlbackend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,6 @@ input UserPermission {
permission: RepositoryPermission = READ
}

# A paginated list of repository diffs committed to git.
type RepositoryComparisonConnection {
# A list of repository diffs committed to git.
nodes: [RepositoryComparison!]!

# The total number of repository diffs in the connection.
totalCount: Int!

# Pagination information.
pageInfo: PageInfo!
}

# The state of a background process.
enum BackgroundProcessState {
# The background process is currently processing items.
Expand Down Expand Up @@ -694,10 +682,6 @@ type Campaign implements Node {
# The date and time when the campaign was updated.
updatedAt: DateTime!

# The combined diff of all changesets (that already exist on the code host) across all affected
# repositories.
repositoryDiffs(first: Int): RepositoryComparisonConnection!

# The changesets in this campaign that already exist on the code host.
changesets(
first: Int
Expand Down
49 changes: 0 additions & 49 deletions enterprise/internal/campaigns/resolvers/campaigns.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package resolvers

import (
"context"
"fmt"
"path"
"sync"
"time"
Expand Down Expand Up @@ -207,21 +206,6 @@ func (r *campaignResolver) ChangesetCountsOverTime(
return resolvers, nil
}

func (r *campaignResolver) RepositoryDiffs(
ctx context.Context,
args *graphqlutil.ConnectionArgs,
) (graphqlbackend.RepositoryComparisonConnectionResolver, error) {
changesetsConnection := &changesetsConnectionResolver{
store: r.store,
opts: ee.ListChangesetsOpts{
CampaignID: r.Campaign.ID,
Limit: int(args.GetFirst()),
},
optsSafe: true,
}
return &changesetDiffsConnectionResolver{changesetsConnection}, nil
}

func (r *campaignResolver) DiffStat(ctx context.Context) (*graphqlbackend.DiffStat, error) {
changesetsConnection := &changesetsConnectionResolver{
store: r.store,
Expand Down Expand Up @@ -260,36 +244,3 @@ func (r *campaignResolver) Status(ctx context.Context) (graphqlbackend.Backgroun
// 🚨 SECURITY: GetCampaignStatus checks whether current user is authorized.
return svc.GetCampaignStatus(ctx, r.Campaign)
}

type changesetDiffsConnectionResolver struct {
*changesetsConnectionResolver
}

func (r *changesetDiffsConnectionResolver) Nodes(ctx context.Context) ([]*graphqlbackend.RepositoryComparisonResolver, error) {
changesets, err := r.changesetsConnectionResolver.Nodes(ctx)
if err != nil {
return nil, err
}

resolvers := make([]*graphqlbackend.RepositoryComparisonResolver, 0, len(changesets))
for _, c := range changesets {
switch c := c.(type) {
case *changesetResolver:
comp, err := c.Diff(ctx)
if err != nil {
return nil, err
}

if comp != nil {
resolvers = append(resolvers, comp)
}
case *hiddenChangesetResolver:
// Do not include hidden changesets in diff and diffstats
continue
default:
return nil, fmt.Errorf("changesetResolver has unknown type: %T", c)
}

}
return resolvers, nil
}

0 comments on commit cd50ee6

Please sign in to comment.