Commit 8a9b713
committed
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/c6c8a52e28c9077580dd2f0552eb2bd6d5e0d13c1 parent 9ba62ad commit 8a9b713
1 file changed
+1
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 16 | | |
28 | 17 | | |
29 | 18 | | |
| |||
33 | 22 | | |
34 | 23 | | |
35 | 24 | | |
36 | | - | |
| 25 | + | |
37 | 26 | | |
38 | 27 | | |
39 | 28 | | |
| |||
0 commit comments