Mercurial > hg
annotate tests/test-dirstate-race2.t @ 44261:04a3ae7aba14
chg: force-set LC_CTYPE on server start to actual value from the environment
Python 3.7+ will "coerce" the LC_CTYPE variable in many instances, and this can
cause issues with chg being able to start up. D7550 attempted to fix this, but a
combination of a misreading of the way that python3.7 does the coercion and an
untested state (LC_CTYPE being set to an invalid value) meant that this was
still not quite working.
This change will cause differences between chg and hg: hg will have the LC_CTYPE
environment variable coerced, while chg will not. This is unlikely to cause any
detectable behavior differences in what Mercurial itself outputs, but it does
have two known effects:
- When using hg, the coerced LC_CTYPE will be passed to subprocesses, even
non-python ones. Using chg will remove the coercion, and this will not
happen. This is arguably more correct behavior on chg's part.
- On macOS, if you set your region to Brazil but your language to English,
this isn't representable in locale strings, so macOS sets LC_CTYPE=UTF-8. If
this value is passed along when ssh'ing to a non-macOS machine, some
functions (such as locale.setlocale()) may raise an exception due to an
unsupported locale setting. This is most easily encountered when doing an
interactive commit/split/etc. when using ui.interface=curses.
Differential Revision: https://phab.mercurial-scm.org/D8039
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Wed, 29 Jan 2020 13:39:50 -0800 |
parents | 87a34c767384 |
children | 93eb6c8035a9 |
rev | line source |
---|---|
42454
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
1 Checking the size/permissions/file-type of files stored in the |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
2 dirstate after an update where the files are changed concurrently |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
3 outside of hg's control. |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
4 |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
5 $ hg init repo |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
6 $ cd repo |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
7 $ echo a > a |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
8 $ hg commit -qAm _ |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
9 $ echo aa > a |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
10 $ hg commit -m _ |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
11 |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
12 $ hg debugdirstate --no-dates |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
13 n 644 3 (set |unset) a (re) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
14 |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
15 $ cat >> $TESTTMP/dirstaterace.py << EOF |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
16 > from mercurial import ( |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
17 > extensions, |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
18 > merge, |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
19 > ) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
20 > def extsetup(ui): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
21 > extensions.wrapfunction(merge, 'applyupdates', wrap) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
22 > def wrap(orig, *args, **kwargs): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
23 > res = orig(*args, **kwargs) |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
24 > with open("a", "w"): |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
25 > pass # just truncate the file |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
26 > return res |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
27 > EOF |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
28 |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
29 Do an update where file 'a' is changed between hg writing it to disk |
42456
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42454
diff
changeset
|
30 and hg writing the dirstate. The dirstate is correct nonetheless, and |
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42454
diff
changeset
|
31 so hg status correctly shows a as clean. |
42454
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
32 |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
33 $ hg up -r 0 --config extensions.race=$TESTTMP/dirstaterace.py |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
35 $ hg debugdirstate --no-dates |
42456
87a34c767384
merge: fix race that could cause wrong size in dirstate
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
42454
diff
changeset
|
36 n 644 2 (set |unset) a (re) |
42454
0eb8c61c306b
tests: show how the dirstate can end up containing wrong information
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents:
diff
changeset
|
37 $ echo a > a; hg status; hg diff |