tests/test-dirstate-backup.t
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Mon, 15 Apr 2024 16:33:37 +0100
branchstable
changeset 51571 74230abb2504
parent 49990 ffd19d73518d
permissions -rw-r--r--
match: strengthen visit_children_set invariant, Recursive means "all files" My previous interpretation of "Recursive" was too relaxed: I thought it instructed the caller to do something like this: > you can stop calling `visit_children_set` because you'll need to descend into > every directory recursively, but you should still check every file if it > matches or not Whereas the real instruction seems to be: > I guarantee that everything in this subtree matches, you can stop > querying the matcher for all files and dirs altogether. The evidence to support this: - the test actually passes with the stronger invariant, revealing no exceptions from this rule - the implementation of `visit_children_set` for `DifferenceMatcher` clearly relies on this requirement, so it must hold for that not to lead to bugs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34939
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     1
Set up
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     2
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     3
  $ hg init repo
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     4
  $ cd repo
49990
ffd19d73518d test: create some history in test-dirstate-backup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45827
diff changeset
     5
  $ echo a > a
ffd19d73518d test: create some history in test-dirstate-backup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45827
diff changeset
     6
  $ hg add a
ffd19d73518d test: create some history in test-dirstate-backup
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45827
diff changeset
     7
  $ hg commit -m a
34939
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     8
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     9
Try to import an empty patch
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    10
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    11
  $ hg import --no-commit - <<EOF
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    12
  > EOF
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    13
  applying patch from stdin
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    14
  abort: stdin: no diffs found
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 34940
diff changeset
    15
  [10]
34939
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    16
34940
c2b30348930f dirstate: clean up when restoring identical backups
Mark Thomas <mbthomas@fb.com>
parents: 34939
diff changeset
    17
No dirstate backups are left behind
34939
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    18
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    19
  $ ls .hg/dirstate* | sort
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    20
  .hg/dirstate
2c80a864e83e tests: add a test demonstrating failure to clean up dirstate backups
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    21