Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve hg revset used by jest-changed-files
The old revset is `ancestor(.^, min(branch(.) and not min(branch(default)), max(public()))`. It can select public commits unintentionally in some cases. In the following two examples, commit A would be selected by the old code path as the "from revision". The new revset would select commit C instead, which is better because the developer won't want to test commits in the `B::C` range. Example 1 - Multiple named branches: E default (named branch), public : | D stable (named branch), draft (only commit the developer cases about) | | | C stable (named branch), public | : | | | B stable (named branch), public |/ A Example 2 - Multiple heads in the "default" named branch: E default (named branch), public, has a bigger revision number than C. : | D default (named branch), draft (only commit the developer cases about) | | | C default (named branch), public | : | | | B default (named branch), public |/ A Explanation of the `min(!public() & ::.)^` revset: With modern Mercurial, `!public()` is the way to select local commits that do not exist on other developer's repos. `& ::.` limits commits to only the current "feature branch" (branch in terms of the commit DAG, not hg named branches). `min` selects the first commit in the non-public feature branch, and `^` selects its immediate parent. Note: it's `!public() & ::.` instead of `::. & !public()` intentionally, because the former has a fast path [1]. [1]: See https://www.mercurial-scm.org/repo/hg/rev/c6c8a52e28c9077580dd2f0552eb2bd6d5e0d13c
- Loading branch information