diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e96a02d2..a7cfe6dd6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ All notable changes to `src-cli` are documented in this file. ### Fixed +- `src batch [preview|apply]` will now check that the target Sourcegraph instance supports batch changes before doing any other work and exit early in the case that it does not. + ### Removed ## 3.36.2 diff --git a/internal/batches/service/service.go b/internal/batches/service/service.go index 49c9adba91..057b25da4f 100644 --- a/internal/batches/service/service.go +++ b/internal/batches/service/service.go @@ -52,12 +52,20 @@ func New(opts *Opts) *Service { } } +// The reason we ask for batchChanges here is to surface errors about trying to use batch +// changes in an unsupported environment sooner, since the version check is typically the +// first thing we do. const sourcegraphVersionQuery = `query SourcegraphVersion { site { - productVersion + productVersion } - } - ` + batchChanges(first: 1) { + nodes { + id + } + } +} +` // getSourcegraphVersion queries the Sourcegraph GraphQL API to get the // current version of the Sourcegraph instance.