Mercurial > hg
annotate tests/test-status-inprocess.py @ 51181:dcaa2df1f688
changelog: never inline changelog
The test suite mostly use small repositories, that implies that most changelog in the
tests are inlined. As a result, non-inlined changelog are quite poorly tested.
Since non-inline changelog are most common case for serious repositories, this
lack of testing is a significant problem that results in high profile issue like
the one recently fixed by 66417f55ea33 and 849745d7da89.
Inlining the changelog does not bring much to the table, the number of total
file saved is negligible, and the changelog will be read by most operation
anyway.
So this changeset is make it so we never inline the changelog, and de-inline the
one that are still inlined whenever we touch them.
By doing that, we remove the "dual code path" situation for writing new entry to
the changelog and move to a "single code path" situation. Having a single
code path simplify the code and make sure it is covered by test (if test cover
that situation obviously)
This impact all tests that care about the number of file and the exchange size,
but there is nothing too complicated in them just a lot of churn.
The churn is made "worse" by the fact rust will use the persistent nodemap on
any changelog now. Which is overall a win as it means testing the persistent
nodemap more and having less special cases.
In short, having inline changelog is mostly useless and an endless source of
pain. We get rid of it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 11 Dec 2023 22:27:59 +0100 |
parents | 6000f5b25c9b |
children |
rev | line source |
---|---|
47500
23f5ed6dbcb1
run-tests: stop writing a `python3` symlink pointing to python2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
45830
diff
changeset
|
1 #!/usr/bin/env python |
28843
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
2 |
37901
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
3 import sys |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
4 |
28843
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
5 from mercurial import ( |
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
6 commands, |
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
7 localrepo, |
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
8 ui as uimod, |
28765
7779f9dfd938
py3: use absolute_import in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
10905
diff
changeset
|
9 ) |
10838
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
10 |
37901
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
11 print_ = print |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39548
diff
changeset
|
12 |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39548
diff
changeset
|
13 |
37901
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
14 def print(*args, **kwargs): |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
15 """print() wrapper that flushes stdout buffers to avoid py3 buffer issues |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
16 |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
17 We could also just write directly to sys.stdout.buffer the way the |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
18 ui object will, but this was easier for porting the test. |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
19 """ |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
20 print_(*args, **kwargs) |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
21 sys.stdout.flush() |
bbff7170f665
tests: fix test-status-inprocess.py on Python 3
Augie Fackler <augie@google.com>
parents:
37660
diff
changeset
|
22 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
39548
diff
changeset
|
23 |
30559
d83ca854fa21
ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents:
28843
diff
changeset
|
24 u = uimod.ui.load() |
10838
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
25 |
28766
7f7cd44cd6d5
py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28765
diff
changeset
|
26 print('% creating repo') |
39548
7ce9dea3a14a
localrepo: move repo creation logic out of localrepository.__init__ (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37901
diff
changeset
|
27 repo = localrepo.instance(u, b'.', create=True) |
10838
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
28 |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
29 f = open('test.py', 'w') |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
30 try: |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
31 f.write('foo\n') |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
32 finally: |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
33 f.close |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
34 |
28766
7f7cd44cd6d5
py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28765
diff
changeset
|
35 print('% add and commit') |
37660
9dfa4e9ed45d
py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
30559
diff
changeset
|
36 commands.add(u, repo, b'test.py') |
9dfa4e9ed45d
py3: add b'' prefixes to tests/test-status-inprocess.py
Pulkit Goyal <7895pulkit@gmail.com>
parents:
30559
diff
changeset
|
37 commands.commit(u, repo, message=b'*') |
28843
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
38 commands.status(u, repo, clean=True) |
10838
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
39 |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
40 |
28766
7f7cd44cd6d5
py3: use print_function in test-status-inprocess.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28765
diff
changeset
|
41 print('% change') |
10838
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
42 f = open('test.py', 'w') |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
43 try: |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
44 f.write('bar\n') |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
45 finally: |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
46 f.close() |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
47 |
07dbafd3a0e2
add a test for the inprocess status dirstate race
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
diff
changeset
|
48 # this would return clean instead of changed before the fix |
28843
2c7e6f363138
tests: stop direct symbol import of mercurial modules in test-status-inprocess
Yuya Nishihara <yuya@tcha.org>
parents:
28824
diff
changeset
|
49 commands.status(u, repo, clean=True, modified=True) |