diff --git a/CHANGELOG.md b/CHANGELOG.md index a760de897316..075bb36680ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - `[jest-cli]` Refactor `-o` and `--coverage` combined ([#7611](https://github.com/facebook/jest/pull/7611)) - `[expect]` Fix custom async matcher stack trace ([#7652](https://github.com/facebook/jest/pull/7652)) +- `[jest-changed-files]` Improve default file selection for Mercurial repos ([#7880](https://github.com/facebook/jest/pull/7880)) ### Chore & Maintenance diff --git a/packages/jest-changed-files/src/hg.ts b/packages/jest-changed-files/src/hg.ts index 0b3b3ecf7963..96cb347a5882 100644 --- a/packages/jest-changed-files/src/hg.ts +++ b/packages/jest-changed-files/src/hg.ts @@ -13,17 +13,6 @@ import {Path, Options, SCMAdapter} from './types'; const env = {...process.env, HGPLAIN: '1'}; -const ANCESTORS = [ - // Parent commit to this one. - '.^', - - // The first commit of my branch, only if we are not on the default branch. - 'min(branch(.)) and not min(branch(default))', - - // Latest public commit. - 'max(public())', -]; - const adapter: SCMAdapter = { findChangedFiles: async ( cwd: string, @@ -33,7 +22,7 @@ const adapter: SCMAdapter = { const args = ['status', '-amnu']; if (options && options.withAncestor) { - args.push('--rev', `ancestor(${ANCESTORS.join(', ')})`); + args.push('--rev', `min(!public() & ::.)^`); } else if (options && options.changedSince) { args.push('--rev', `ancestor(., ${options.changedSince})`); } else if (options && options.lastCommit === true) {