Skip to content

Commit f27d1c1

Browse files
quark-zjuSimenB
authored andcommitted
Improve hg revset used by jest-changed-files (#7880)
1 parent 300de98 commit f27d1c1

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- `[jest-cli]` Refactor `-o` and `--coverage` combined ([#7611](https://github.com/facebook/jest/pull/7611))
1010
- `[expect]` Fix custom async matcher stack trace ([#7652](https://github.com/facebook/jest/pull/7652))
11+
- `[jest-changed-files]` Improve default file selection for Mercurial repos ([#7880](https://github.com/facebook/jest/pull/7880))
1112

1213
### Chore & Maintenance
1314

packages/jest-changed-files/src/hg.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ import {Path, Options, SCMAdapter} from './types';
1313

1414
const env = {...process.env, HGPLAIN: '1'};
1515

16-
const ANCESTORS = [
17-
// Parent commit to this one.
18-
'.^',
19-
20-
// The first commit of my branch, only if we are not on the default branch.
21-
'min(branch(.)) and not min(branch(default))',
22-
23-
// Latest public commit.
24-
'max(public())',
25-
];
26-
2716
const adapter: SCMAdapter = {
2817
findChangedFiles: async (
2918
cwd: string,
@@ -33,7 +22,7 @@ const adapter: SCMAdapter = {
3322

3423
const args = ['status', '-amnu'];
3524
if (options && options.withAncestor) {
36-
args.push('--rev', `ancestor(${ANCESTORS.join(', ')})`);
25+
args.push('--rev', `min(!public() & ::.)^`);
3726
} else if (options && options.changedSince) {
3827
args.push('--rev', `ancestor(., ${options.changedSince})`);
3928
} else if (options && options.lastCommit === true) {

0 commit comments

Comments
 (0)