Skip to content

Commit

Permalink
batches: fail earlier on dotcom (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
courier-new authored Feb 3, 2022
1 parent 3859979 commit 2d7170b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions internal/batches/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2d7170b

Please sign in to comment.