Skip to content

Add BaseRef field to CampaignPlanPatch and use commitID in BaseRevision#158

Merged
mrnugget merged 2 commits intomasterfrom
patch-base-ref
Mar 12, 2020
Merged

Add BaseRef field to CampaignPlanPatch and use commitID in BaseRevision#158
mrnugget merged 2 commits intomasterfrom
patch-base-ref

Conversation

@mrnugget
Copy link
Copy Markdown
Contributor

This implements the src CLI tasks of https://github.com/sourcegraph/sourcegraph/issues/8846

With this change src CLI uses the commit ID (instead of refspec) as the
CampaignPlanPatch.BaseRevision when creating a CampaignPlan.

It also adds the additional baseRef field to CampaignPlanPatch and
sends that to the GraphQL.

Since Sourcegraph <3.14 expects the baseRevision of a
CampaignPlanPatch to contain a ref (e.g. "refs/heads/master") we check
the Sourcegraph version and fall back to that behaviour so that
customers can use a newer src CLI version with their <3.14
instance.

With the addition of these fields to ActionRepo and CampaignPlanPatch
the cache of src CLI is now also busted when the revision of the default
branch of a repo changes.

This implements the src CLI tasks of sourcegraph/sourcegraph#8846

With this change src CLI uses the commit ID (instead of refspec) as the
`CampaignPlanPatch.BaseRevision` when creating a `CampaignPlan`.

It also adds the additional `baseRef` field to `CampaignPlanPatch` and
sends that to the GraphQL.

Since Sourcegraph <3.14 expects the `baseRevision` of a
`CampaignPlanPatch` to contain a ref (e.g. "refs/heads/master") we check
the Sourcegraph version and fall back to that behaviour so that
customers can use a newer src CLI version with their <3.14
instance.

With the addition of these fields to ActionRepo and CampaignPlanPatch
the cache of src CLI is now also busted when the revision of the default
branch of a repo changes.
Copy link
Copy Markdown
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

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

Very good, note to myself: port this over for remote code execution

Comment thread cmd/src/campaign_plans_create_from_patches.go Outdated
@ryanslade ryanslade changed the title Add BaseRef field to CampaignPlanPlatch and use commitID in BaseRevision Add BaseRef field to CampaignPlanPatch and use commitID in BaseRevision Mar 12, 2020
Co-Authored-By: Erik Seliger <erikseliger@me.com>
@mrnugget mrnugget merged commit fd1ed5d into master Mar 12, 2020
mrnugget added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Mar 12, 2020
This is part of sourcegraph/sourcegraph#8846
and bumps the src CLI so that
sourcegraph/src-cli#158 is included.
mrnugget added a commit to sourcegraph/sourcegraph-public-snapshot that referenced this pull request Mar 12, 2020
scjohns pushed a commit that referenced this pull request Apr 24, 2023
…on (#158)

* Add BaseRef field to CampaignPlanPlatch and use commitID in BaseRevision

This implements the src CLI tasks of sourcegraph/sourcegraph#8846

With this change src CLI uses the commit ID (instead of refspec) as the
`CampaignPlanPatch.BaseRevision` when creating a `CampaignPlan`.

It also adds the additional `baseRef` field to `CampaignPlanPatch` and
sends that to the GraphQL.

Since Sourcegraph <3.14 expects the `baseRevision` of a
`CampaignPlanPatch` to contain a ref (e.g. "refs/heads/master") we check
the Sourcegraph version and fall back to that behaviour so that
customers can use a newer src CLI version with their <3.14
instance.

With the addition of these fields to ActionRepo and CampaignPlanPatch
the cache of src CLI is now also busted when the revision of the default
branch of a repo changes.

* Update cmd/src/campaign_plans_create_from_patches.go

Co-Authored-By: Erik Seliger <erikseliger@me.com>

Co-authored-by: Erik Seliger <erikseliger@me.com>
@keegancsmith keegancsmith deleted the patch-base-ref branch November 11, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants