Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve hg revset used by jest-changed-files #7880

Merged
merged 2 commits into from
Feb 13, 2019
Merged

Commits on Feb 13, 2019

  1. 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
    quark-zju committed Feb 13, 2019
    Configuration menu
    Copy the full SHA
    bff81f5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5f2d3b8 View commit details
    Browse the repository at this point in the history