Mercurial > hg
annotate tests/test-sparse-requirement.t @ 34107:4f60720cf0df
blackbox: fix rotation with chg
The added test will show:
$ $PYTHON showsize.py .hg/blackbox*
.hg/blackbox.log: < 500
.hg/blackbox.log.1: < 500
.hg/blackbox.log.2: < 500
.hg/blackbox.log.3: < 500
.hg/blackbox.log.4: < 500
.hg/blackbox.log.5: >= 500
with previous code.
The issue is caused by blackbox caching file objects *by path*, and the
rotation size check could run on a wrong file object (i.e. it should check
"blackbox.log", but `filehandles["blackbox.log"]` contains a file object
that has been renamed to "blackbox.log.5").
This patch removes the "filehandlers" global cache added by 45313f5a3a8c to
solve the issue.
I think the original patch was trying to make different ui objects use a same
file object if their blackbox.log path is the same. In theory it could also
be problematic in the rotation case. Anyway, that should become unnecessary
after D650.
Differential Revision: https://phab.mercurial-scm.org/D648
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 06 Sep 2017 19:27:30 -0700 |
parents | 22371eabb3b1 |
children | c2c8962a9465 |
rev | line source |
---|---|
33556
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 $ hg init repo |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 $ cd repo |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 $ touch a.html b.html c.py d.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 $ cat > frontend.sparse << EOF |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 > [include] |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 > *.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 > EOF |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 $ hg -q commit -A -m initial |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 $ echo 1 > a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 $ echo 1 > c.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 $ hg commit -m 'commit 1' |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 Enable sparse profile |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 store |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 $ hg debugsparse --config extensions.sparse= --enable-profile frontend.sparse |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 $ ls |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 b.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 Requirement for sparse added when sparse is enabled |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
34 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 exp-sparse |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 store |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 Client without sparse enabled reacts properly |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 $ hg files |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 abort: repository is using sparse feature but sparse is not enabled; enable the "sparse" extensions to access! |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 [255] |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 Requirement for sparse is removed when sparse is disabled |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 $ hg debugsparse --reset --config extensions.sparse= |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 $ cat .hg/requires |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 dotencode |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 fncache |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 generaldelta |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 revlogv1 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 store |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 And client without sparse can access |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 $ hg files |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 a.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 b.html |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 c.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 d.py |
22371eabb3b1
sparse: add a requirement when a repository uses sparse (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 frontend.sparse |