tests/test-strict.t
author Arun Kulshreshtha <akulshreshtha@janestreet.com>
Tue, 30 Aug 2022 15:29:55 -0400
changeset 49491 c6a1beba27e9
parent 46262 9c9e0b4b2ca7
child 49621 55c6ebd11cb9
permissions -rw-r--r--
bisect: avoid copying ancestor list for non-merge commits During a bisection, hg needs to compute a list of all ancestors for every candidate commit. This is accomplished via a bottom-up traversal of the set of candidates, during which each revision's ancestor list is populated using the ancestor list of its parent(s). Previously, this involved copying the entire list, which could be very long in if the bisection range was large. To help improve this, we can observe that each candidate commit is visited exactly once, at which point its ancestor list is copied into its children's lists and then dropped. In the case of non-merge commits, a commit's ancestor list consists exactly of its parent's list plus itself. This means that we can trivially reuse the parent's existing list for one of its non-merge children, which avoids copying entirely if that commit is the parent's only child. This makes bisections over linear ranges of commits much faster. During some informal testing in the large publicly-available `mozilla-central` repository, this noticeably sped up bisections over large ranges of history: Setup: $ cd mozilla-central $ hg bisect --reset $ hg bisect --good 0 $ hg log -r tip -T '{rev}\n' 628417 Test: $ time hg bisect --bad tip --noupdate Before: real 3m35.927s user 3m35.553s sys 0m0.319s After: real 1m41.142s user 1m40.810s sys 0m0.285s
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     1
  $ hg init
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     2
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     3
  $ echo a > a
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     4
  $ hg ci -Ama
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     5
  adding a
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     6
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     7
  $ hg an a
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
     8
  0: a
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     9
16591
46e9ed223d2c commands: parse ui.strict config item as bool
Yuya Nishihara <yuya@tcha.org>
parents: 15862
diff changeset
    10
  $ hg --config ui.strict=False an a
46e9ed223d2c commands: parse ui.strict config item as bool
Yuya Nishihara <yuya@tcha.org>
parents: 15862
diff changeset
    11
  0: a
46e9ed223d2c commands: parse ui.strict config item as bool
Yuya Nishihara <yuya@tcha.org>
parents: 15862
diff changeset
    12
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    13
  $ echo "[ui]" >> $HGRCPATH
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    14
  $ echo "strict=True" >> $HGRCPATH
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    15
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    16
  $ hg an a
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    17
  hg: unknown command 'an'
38787
5199c5b6fd29 dispatch: don't show list of commands on bogus command
Martin von Zweigbergk <martinvonz@google.com>
parents: 29974
diff changeset
    18
  (use 'hg help' for a list of commands)
46262
9c9e0b4b2ca7 error: use detailed exit code 10 for command errors
Martin von Zweigbergk <martinvonz@google.com>
parents: 38787
diff changeset
    19
  [10]
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    20
  $ hg annotate a
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    21
  0: a
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    22
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    23
should succeed - up is an alias, not an abbreviation
2988
63c3a1921a67 Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    24
12097
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    25
  $ hg up
389c215885c5 tests: unify test-strict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8167
diff changeset
    26
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved