sapling/eden/scm/tests/test-casefolding.t
Durham Goode 4d151cc31d tests: enable rust status for case folding tests
Summary:
Now that we can handle case folding, let's enable Rust status for those
tests. We also need to migrate the tests to modernclient configs in the process.

Note, there are two behavior changes here.

1. In the Python code, case insensitivity is handled by normalizing the user
inputs (i.e. 'hg add SOME_FILE') and the files coming off the filesystem. The
matchers themselves are not case insensitive. This causes some limitations, like
where regex's or user inputs that are converted to regex's do not use case
insensitive comparison.

In the Rust code, the user input isn't normalized, and instead we do case
insensitive matching. We then normalize the output of status before showing it
to the user. This should provide better matching in the long-term, but right now
there is an issue where if the Rust status logic has a Python matcher object,
the Rust file system walker will handle non-normalized paths to the matcher
(which isn't case insensitive and expects normalized paths) and therefore won't
match. This can impact 'hg add foo/bar' when the case of foo in the treestate is
FOO.  The python matcher gets normalized to "FOO", then the Rust status logic
hands it 'foo/bar', which fails to match and the 'hg add' does nothing. Using
`hg add 'glob:**/bar'` can work around this. Once we move to rust regex
matchers, the matcher will be case insensitive and this will stop being an
issue.

2. In the Python code we also normalize directory names. So for instance, if you
have "foo/bar" in your treestate, and "FOO/xxx" on disk, doing 'hg add FOO/xxx'
will actually add "foo/xxx". This avoids accidentally creating different
cased directories on disk. TreeState.normalize currently doesn't normalize
directories, so this doesn't currently work. But, it turns out this didn't work
well before either. In a Watchman repository the treestate is missing most
files, so Python normalization also doesn't catch this case.  In an Eden
repository, Eden handles the normalization for you, and therefore this isn't an
issue. So while the Rust status doesn't handle this, it's not a regression.

Reviewed By: quark-zju

Differential Revision: D40164595

fbshipit-source-id: 85a421a71ff2d5a451285f81f48c9b375a786d65
2022-10-17 11:56:11 -07:00

152 lines
2.8 KiB
Perl

#require icasefs
$ configure modernclient
$ hg debugfsinfo | grep 'case-sensitive:'
case-sensitive: no
test file addition with bad case
$ setconfig devel.segmented-changelog-rev-compat=True
$ newclientrepo repo1
$ echo a > a
$ hg add A
$ hg st
A a
$ hg ci -m adda
$ hg manifest
a
$ cd ..
test case collision on rename (issue750)
$ newclientrepo repo2
$ echo a > a
$ hg --debug ci -Am adda
adding a
committing files:
a
committing manifest
committing changelog
committed 07f4944404050f47db2e5c5071e0e84e7a27bba9
Case-changing renames should work:
$ hg mv a A
$ hg mv A a
$ hg st
addremove after case-changing rename has no effect (issue4590)
$ hg mv a A
$ hg addremove
recording removal of a as rename to A (100% similar)
$ hg revert --all
forgetting A
undeleting a
test changing case of path components
$ mkdir D
$ echo b > D/b
$ hg ci -Am addb D/b
$ hg mv D/b d/b
D/b: not overwriting - file already committed
(hg rename --force to replace the file by recording a rename)
$ hg mv D/b d/c
$ hg st
A D/c
R D/b
$ mv D temp
$ mv temp d
$ hg st
A D/c
R D/b
$ hg revert -aq
$ rm d/c
$ echo c > D/c
$ hg add "glob:**/c"
adding d/c (no-fsmonitor !)
warning: possible case-folding collision for D/c (fsmonitor !)
adding D/c (fsmonitor !)
$ hg st
A d/c (no-fsmonitor !)
A D/c (fsmonitor !)
$ hg ci -m addc "glob:**/c"
$ hg mv d/b d/e
$ hg st
A D/e
R D/b
$ hg revert -aq
$ rm d/e
$ hg mv d/b D/B
$ hg st
A D/B
R D/b
$ cd ..
test case collision between revisions (issue912)
$ newclientrepo repo3
$ echo a > a
$ hg ci -Am adda
adding a
$ hg rm a
$ hg ci -Am removea
$ echo B > B
$ echo A > A
on linux hfs keeps the old case stored, force it
$ mv a aa
$ mv aa A
$ hg ci -Am addA
adding A
adding B
used to fail under case insensitive fs
$ hg up -C 0
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ hg up -C
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
no clobbering of untracked files with wrong casing
$ hg up -r 0
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ echo gold > b
$ hg up
B: untracked file differs
abort: untracked files in working directory differ from files in requested revision
[255]
$ cat b
gold
$ rm b
$ cd ..
issue 3342: file in nested directory causes unexpected abort
$ newclientrepo issue3342
$ mkdir -p a/B/c/D
$ echo e > a/B/c/D/e
$ hg add a/B/c/D/e
$ hg ci -m 'add e'
issue 4481: revert across case only renames
$ hg mv a/B/c/D/e a/B/c/d/E
$ hg ci -m "uppercase E"
$ echo 'foo' > a/B/c/D/E
$ hg ci -m 'e content change'
$ hg revert --all -r .~2
removing a/B/c/D/E
adding a/B/c/D/e
$ find * | sort
a
a/B
a/B/c
a/B/c/D
a/B/c/D/e
a/B/c/D/e.orig