author | Pierre-Yves David <pierre-yves.david@octobus.net> |
Thu, 14 Jan 2021 11:46:30 +0100 | |
changeset 46266 | e8b0c519dfb3 |
parent 45681 | a736ab681b78 |
permissions | -rw-r--r-- |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 |
test sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 |
$ hg init myrepo |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
$ cd myrepo |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
5 |
$ cat >> $HGRCPATH <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
6 |
> [extensions] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
7 |
> sparse= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
8 |
> purge= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
9 |
> strip= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
10 |
> rebase= |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
11 |
> EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
12 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 |
$ echo a > index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
14 |
$ echo x > data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
15 |
$ echo z > readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 |
$ cat > base.sparse <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
18 |
> *.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 |
> EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
20 |
$ hg ci -Aqm 'initial' |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 |
$ cat > webpage.sparse <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 |
> %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 |
> *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
25 |
> EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
$ hg ci -Aqm 'initial' |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
27 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 |
Import a rules file against a 'blank' sparse profile |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
33 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
34 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
35 |
$ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
36 |
.hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
38 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
39 |
$ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
$ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 |
> %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
47 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
48 |
$ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
49 |
.hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 |
base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 |
webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
54 |
$ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 |
$ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
57 |
Start against an existing profile; rules *already active* should be ignored |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
59 |
$ hg debugsparse --enable-profile webpage.sparse |
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
60 |
$ hg debugsparse --include *.py |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 |
> %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 |
> *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 |
> *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 |
> [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
69 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import |
44724
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
70 |
$ ls -A |
5c2a4f37eace
tests: deal with "ls" vs "ls -A" difference on 2BSD derived systems
Joerg Sonnenberger <joerg@bec.de>
parents:
33324
diff
changeset
|
71 |
.hg |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 |
base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 |
index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 |
readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 |
webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 |
$ cat .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
%include webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 |
[include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 |
*.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
*.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
81 |
[exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 |
*.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
84 |
$ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 |
$ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 |
Same tests, with -Tjson enabled to output summaries |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
90 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
91 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
93 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 |
[ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 |
{ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 |
"exclude_rules_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 |
"files_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 |
"files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 |
"files_dropped": 4, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 |
"include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 |
"profiles_added": 0 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
102 |
} |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 |
] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
104 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
105 |
$ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
106 |
$ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
108 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
109 |
> %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
110 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
111 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
113 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
114 |
[ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 |
{ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 |
"exclude_rules_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
117 |
"files_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 |
"files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 |
"files_dropped": 2, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 |
"include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 |
"profiles_added": 1 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
122 |
} |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 |
] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
124 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
125 |
$ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
126 |
$ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
127 |
|
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
128 |
$ hg debugsparse --enable-profile webpage.sparse |
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
129 |
$ hg debugsparse --include *.py |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
130 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 |
> %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 |
> *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
134 |
> *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
135 |
> [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
136 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
137 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
138 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 |
[ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 |
{ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
141 |
"exclude_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 |
"files_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 |
"files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
144 |
"files_dropped": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
145 |
"include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
146 |
"profiles_added": 0 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
147 |
} |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
148 |
] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
149 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
150 |
If importing results in no new rules being added, no refresh should take place! |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
151 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
152 |
$ cat > $TESTTMP/trap_sparse_refresh.py <<EOF |
33324
33d0859c37bd
sparse: move working directory refreshing into core
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33293
diff
changeset
|
153 |
> from mercurial import error, sparse |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
154 |
> def extsetup(ui): |
33324
33d0859c37bd
sparse: move working directory refreshing into core
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33293
diff
changeset
|
155 |
> def abort_refresh(*args, **kwargs): |
45681
a736ab681b78
errors: stop passing non-strings to Abort's constructor
Martin von Zweigbergk <martinvonz@google.com>
parents:
44724
diff
changeset
|
156 |
> raise error.Abort(b'sparse._refresh called!') |
33324
33d0859c37bd
sparse: move working directory refreshing into core
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33293
diff
changeset
|
157 |
> sparse.refreshwdir = abort_refresh |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
158 |
> EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
159 |
$ cat >> $HGRCPATH <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
160 |
> [extensions] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
161 |
> trap_sparse_refresh=$TESTTMP/trap_sparse_refresh.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
162 |
> EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
163 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
164 |
> [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
165 |
> *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
166 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
167 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
168 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
169 |
If an exception is raised during refresh, restore the existing rules again. |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
170 |
|
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
171 |
$ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
172 |
> [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
173 |
> *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
174 |
> EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
175 |
$ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
176 |
abort: sparse._refresh called! |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
177 |
[255] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
178 |
$ cat .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
179 |
%include webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 |
[include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
181 |
*.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
182 |
*.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
183 |
[exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
184 |
*.py |