Mercurial > hg
annotate tests/test-sparse-import.t @ 37611:ae8730877371
httppeer: basic implementation of capabilities interface
This is a bit crude. The capabilities mechanism for version 2 of
the wire protocol is a bit different from version 1. And code
in core is relying on strings passed to capable() matching strings
advertised by the "capabilities" wire protocol command. I may
refactor the internal checking mechanism to be a bit more
abstract or based on interfaces. Time will tell...
Differential Revision: https://phab.mercurial-scm.org/D3256
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 10 Apr 2018 19:09:35 -0700 |
parents | 33d0859c37bd |
children | 5c2a4f37eace |
rev | line source |
---|---|
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 |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
35 $ ls |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
36 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
38 $ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
39 $ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
42 > %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
43 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
46 $ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 $ ls |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 data.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
52 $ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 $ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
55 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
|
56 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
57 $ hg debugsparse --enable-profile webpage.sparse |
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
58 $ hg debugsparse --include *.py |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 > %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 > *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 > *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 > [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
67 $ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
68 $ ls |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
69 base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
70 index.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
71 readme.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 $ cat .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
74 %include webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
75 [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 [exclude] |
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 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
81 $ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
82 $ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
83 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
84 Same tests, with -Tjson enabled to output summaries |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
87 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
88 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
90 $ 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
|
91 [ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
92 { |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
93 "exclude_rules_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
94 "files_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
95 "files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 "files_dropped": 4, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 "include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
98 "profiles_added": 0 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
99 } |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
100 ] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
102 $ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
103 $ rm .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
104 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
105 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
106 > %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
107 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
108 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
109 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
110 $ 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
|
111 [ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
112 { |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
113 "exclude_rules_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
114 "files_added": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
115 "files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
116 "files_dropped": 2, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
117 "include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
118 "profiles_added": 1 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
119 } |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
120 ] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
121 |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
122 $ hg debugsparse --reset |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 $ rm .hg/sparse |
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 --enable-profile webpage.sparse |
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
126 $ hg debugsparse --include *.py |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
127 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
128 > %include base.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
129 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
130 > *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
131 > *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 > [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
133 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
134 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
135 $ 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
|
136 [ |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
137 { |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
138 "exclude_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
139 "files_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
140 "files_conflicting": 0, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
141 "files_dropped": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
142 "include_rules_added": 1, |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
143 "profiles_added": 0 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
144 } |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
145 ] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
146 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
147 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
|
148 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
149 $ 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
|
150 > from mercurial import error, sparse |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
151 > def extsetup(ui): |
33324
33d0859c37bd
sparse: move working directory refreshing into core
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33293
diff
changeset
|
152 > def abort_refresh(*args, **kwargs): |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
153 > raise error.Abort('sparse._refresh called!') |
33324
33d0859c37bd
sparse: move working directory refreshing into core
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33293
diff
changeset
|
154 > sparse.refreshwdir = abort_refresh |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
155 > EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
156 $ cat >> $HGRCPATH <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
157 > [extensions] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
158 > trap_sparse_refresh=$TESTTMP/trap_sparse_refresh.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
159 > EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
160 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
161 > [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
162 > *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
163 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
164 $ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
165 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
166 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
|
167 |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
168 $ cat > $TESTTMP/rules_to_import <<EOF |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
169 > [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
170 > *.html |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
171 > EOF |
33293
c9cbf4de27ba
sparse: rename command to debugsparse
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33289
diff
changeset
|
172 $ hg debugsparse --import-rules $TESTTMP/rules_to_import |
33289
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
173 abort: sparse._refresh called! |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
174 [255] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
175 $ cat .hg/sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
176 %include webpage.sparse |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
177 [include] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
178 *.py |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
179 *.txt |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
180 [exclude] |
abd7dedbaa36
sparse: vendor Facebook-developed extension
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
181 *.py |