annotate tests/test-fileset.t @ 30559:d83ca854fa21

ui: factor out ui.load() to create a ui without loading configs (API) This allows us to write doctests depending on a ui object, but not on global configs. ui.load() is a class method so we can do wsgiui.load(). All ui() calls but for doctests are replaced with ui.load(). Some of them could be changed to not load configs later.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Oct 2016 14:35:10 +0900
parents 4eb5496c2bd4
children 4140d49d2efb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
1 $ fileset() {
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
2 > hg debugfileset "$@"
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
3 > }
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
4
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
5 $ hg init repo
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
6 $ cd repo
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
7 $ echo a > a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
8 $ echo a > a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
9 $ echo b > b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
10 $ echo b > b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
11 $ hg ci -Am addfiles
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
12 adding a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
13 adding a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
14 adding b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
15 adding b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
16
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
17 Test operators and basic patterns
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
18
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
19 $ fileset -v a1
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
20 ('symbol', 'a1')
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
21 a1
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
22 $ fileset -v 'a*'
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
23 ('symbol', 'a*')
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
24 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
25 a2
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
26 $ fileset -v '"re:a\d"'
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
27 ('string', 're:a\\d')
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
28 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
29 a2
25255
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
30 $ fileset -v 'a1 or a2'
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
31 (or
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
32 ('symbol', 'a1')
ad1d2c952889 fileset: pretty print syntax tree in debug output
Yuya Nishihara <yuya@tcha.org>
parents: 24430
diff changeset
33 ('symbol', 'a2'))
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
34 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
35 a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
36 $ fileset 'a1 | a2'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
37 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
38 a2
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
39 $ fileset 'a* and "*1"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
40 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
41 $ fileset 'a* & "*1"'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
42 a1
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
43 $ fileset 'not (r"a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
44 b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
45 b2
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
46 $ fileset '! ("a*")'
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
47 b1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
48 b2
17363
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
49 $ fileset 'a* - a1'
5d9e2031c0b1 fileset: actually implement 'minusset'
Patrick Mezard <patrick@mezard.eu>
parents: 17362
diff changeset
50 a2
19470
19ac0d8ee9a2 fileset: handle underbar in symbols
Matt Mackall <mpm@selenic.com>
parents: 18842
diff changeset
51 $ fileset 'a_b'
26233
d3dbb65c8dc6 fileset: handle error of string unescaping
Yuya Nishihara <yuya@tcha.org>
parents: 25925
diff changeset
52 $ fileset '"\xy"'
d3dbb65c8dc6 fileset: handle error of string unescaping
Yuya Nishihara <yuya@tcha.org>
parents: 25925
diff changeset
53 hg: parse error: invalid \x escape
d3dbb65c8dc6 fileset: handle error of string unescaping
Yuya Nishihara <yuya@tcha.org>
parents: 25925
diff changeset
54 [255]
17362
bd867a9ca510 tests: test filesets with test-fileset.t
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
55
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
56 Test files status
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
57
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
58 $ rm a1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
59 $ hg rm a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
60 $ echo b >> b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
61 $ hg cp b1 c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
62 $ echo c > c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
63 $ echo c > c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
64 $ cat > .hgignore <<EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
65 > \.hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
66 > 2$
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
67 > EOF
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
68 $ fileset 'modified()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
69 b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
70 $ fileset 'added()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
71 c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
72 $ fileset 'removed()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
73 a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
74 $ fileset 'deleted()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
75 a1
27024
ceef5fb14872 fileset: add missing() predicate (issue4925)
liscju <piotr.listkiewicz@gmail.com>
parents: 26953
diff changeset
76 $ fileset 'missing()'
ceef5fb14872 fileset: add missing() predicate (issue4925)
liscju <piotr.listkiewicz@gmail.com>
parents: 26953
diff changeset
77 a1
17364
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
78 $ fileset 'unknown()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
79 c3
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
80 $ fileset 'ignored()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
81 .hgignore
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
82 c2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
83 $ fileset 'hgignore()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
84 a2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
85 b2
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
86 $ fileset 'clean()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
87 b1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
88 $ fileset 'copied()'
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
89 c1
0c41fb2d972a test-fileset: test file status predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17363
diff changeset
90
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
91 Test files properties
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
92
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
93 >>> file('bin', 'wb').write('\0a')
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
94 $ fileset 'binary()'
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
95 $ fileset 'binary() and unknown()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
96 bin
17367
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
97 $ echo '^bin$' >> .hgignore
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
98 $ fileset 'binary() and ignored()'
ce625185cfd9 fileset: matchctx.existing() must consider ignored files
Patrick Mezard <patrick@mezard.eu>
parents: 17366
diff changeset
99 bin
17366
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
100 $ hg add bin
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
101 $ fileset 'binary()'
04c65cb59467 fileset: matchctx.existing() must consider unknown files
Patrick Mezard <patrick@mezard.eu>
parents: 17365
diff changeset
102 bin
17365
8a0513bf030a fileset: exclude deleted files from matchctx.existing()
Patrick Mezard <patrick@mezard.eu>
parents: 17364
diff changeset
103
17368
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
104 $ fileset 'grep("b{1}")'
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
105 b2
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
106 c1
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
107 b1
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
108 $ fileset 'grep("missingparens(")'
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
109 hg: parse error: invalid match pattern: unbalanced parenthesis
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
110 [255]
01cc267fc105 fileset: do not traceback on invalid grep pattern
Patrick Mezard <patrick@mezard.eu>
parents: 17367
diff changeset
111
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
112 #if execbit
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
113 $ chmod +x b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
114 $ fileset 'exec()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
115 b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
116 #endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
117
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
118 #if symlink
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
119 $ ln -s b2 b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
120 $ fileset 'symlink() and unknown()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
121 b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
122 $ hg add b2link
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
123 #endif
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
124
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
125 #if no-windows
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
126 $ echo foo > con.xml
24430
98d9d33dfd95 test-fileset.t: remove 'bar ' and 'baz\' from tested filenames
Siddharth Agarwal <sid0@fb.com>
parents: 24424
diff changeset
127 $ fileset 'not portable()'
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
128 con.xml
24430
98d9d33dfd95 test-fileset.t: remove 'bar ' and 'baz\' from tested filenames
Siddharth Agarwal <sid0@fb.com>
parents: 24424
diff changeset
129 $ hg --config ui.portablefilenames=ignore add con.xml
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
130 #endif
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
131
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
132 >>> file('1k', 'wb').write(' '*1024)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
133 >>> file('2k', 'wb').write(' '*2048)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
134 $ hg add 1k 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
135 $ fileset 'size("bar")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
136 hg: parse error: couldn't parse size: bar
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
137 [255]
27518
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
138 $ fileset '(1k, 2k)'
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
139 hg: parse error: can't use a list in this context
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
140 (see hg help "filesets.x or y")
737ffdabbde9 fileset: add hint for list error to use or
timeless <timeless@mozdev.org>
parents: 27477
diff changeset
141 [255]
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
142 $ fileset 'size(1k)'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
143 1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
144 $ fileset '(1k or 2k) and size("< 2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
145 1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
146 $ fileset '(1k or 2k) and size("<=2k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
147 1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
148 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
149 $ fileset '(1k or 2k) and size("> 1k")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
150 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
151 $ fileset '(1k or 2k) and size(">=1K")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
152 1k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
153 2k
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
154 $ fileset '(1k or 2k) and size(".5KB - 1.5kB")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
155 1k
25925
23c4589fc678 filesets: ignore unit case in size() predicate for single value
Anton Shestakov <av6@dwimlabs.net>
parents: 25587
diff changeset
156 $ fileset 'size("1M")'
23c4589fc678 filesets: ignore unit case in size() predicate for single value
Anton Shestakov <av6@dwimlabs.net>
parents: 25587
diff changeset
157 $ fileset 'size("1 GB")'
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
158
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
159 Test merge states
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
160
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
161 $ hg ci -m manychanges
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
162 $ hg up -C 0
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
163 * files updated, 0 files merged, * files removed, 0 files unresolved (glob)
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
164 $ echo c >> b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
165 $ hg ci -m diverging b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
166 created new head
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
167 $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
168 $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
169 $ hg merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
170 merging b2
26614
ef1eb6df7071 simplemerge: move conflict warning message to filemerge
Siddharth Agarwal <sid0@fb.com>
parents: 26233
diff changeset
171 warning: conflicts while merging b2! (edit, then use 'hg resolve --mark')
26953
2da6a2dbfc42 test-fileset: glob the updated file count for Windows stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26614
diff changeset
172 * files updated, 0 files merged, 1 files removed, 1 files unresolved (glob)
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
173 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
174 [1]
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
175 $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
176 $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
177 b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
178 $ echo e > b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
179 $ hg resolve -m b2
21947
b081decd9062 resolve: add parenthesis around "no more unresolved files" message
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 21267
diff changeset
180 (no more unresolved files)
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
181 $ fileset 'resolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
182 b2
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
183 $ fileset 'unresolved()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
184 $ hg ci -m merge
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
185
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
186 Test subrepo predicate
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
187
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
188 $ hg init sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
189 $ echo a > sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
190 $ hg -R sub add sub/suba
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
191 $ hg -R sub ci -m sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
192 $ echo 'sub = sub' > .hgsub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
193 $ hg init sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
194 $ echo b > sub2/b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
195 $ hg -R sub2 ci -Am sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
196 adding b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
197 $ echo 'sub2 = sub2' >> .hgsub
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
198 $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
199 $ hg add .hgsub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
200 $ fileset 'subrepo()'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
201 sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
202 sub2
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
203 $ fileset 'subrepo("sub")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
204 sub
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
205 $ fileset 'subrepo("glob:*")'
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
206 sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
207 sub2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
208 $ hg ci -m subrepo
17369
b360011a132d test-fileset: test remaining predicates
Patrick Mezard <patrick@mezard.eu>
parents: 17368
diff changeset
209
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
210 Test that .hgsubstate is updated as appropriate during a conversion. The
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
211 saverev property is enough to alter the hashes of the subrepo.
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
212
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
213 $ hg init ../converted
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
214 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
215 > sub ../converted/sub
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
216 initializing destination ../converted/sub repository
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
217 scanning source...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
218 sorting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
219 converting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
220 0 sub
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
221 $ hg clone -U sub2 ../converted/sub2
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
222 $ hg --config extensions.convert= convert --config convert.hg.saverev=True \
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
223 > . ../converted
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
224 scanning source...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
225 sorting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
226 converting...
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
227 4 addfiles
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
228 3 manychanges
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
229 2 diverging
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
230 1 merge
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
231 0 subrepo
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
232 no ".hgsubstate" updates will be made for "sub2"
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
233 $ hg up -q -R ../converted -r tip
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
234 $ hg --cwd ../converted cat sub/suba sub2/b -r tip
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
235 a
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
236 b
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
237 $ oldnode=`hg log -r tip -T "{node}\n"`
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
238 $ newnode=`hg log -R ../converted -r tip -T "{node}\n"`
25587
49fb24f72747 test-fileset: remove bashism, use test instead of '[[ ]]'
Yuya Nishihara <yuya@tcha.org>
parents: 25558
diff changeset
239 $ [ "$oldnode" != "$newnode" ] || echo "nothing changed"
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
240
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
241 Test with a revision
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
242
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
243 $ hg log -G --template '{rev} {desc}\n'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
244 @ 4 subrepo
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
245 |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
246 o 3 merge
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
247 |\
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
248 | o 2 diverging
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
249 | |
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
250 o | 1 manychanges
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
251 |/
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
252 o 0 addfiles
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
253
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
254 $ echo unknown > unknown
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
255 $ fileset -r1 'modified()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
256 b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
257 $ fileset -r1 'added() and c1'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
258 c1
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
259 $ fileset -r1 'removed()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
260 a2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
261 $ fileset -r1 'deleted()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
262 $ fileset -r1 'unknown()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
263 $ fileset -r1 'ignored()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
264 $ fileset -r1 'hgignore()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
265 b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
266 bin
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
267 $ fileset -r1 'binary()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
268 bin
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
269 $ fileset -r1 'size(1k)'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
270 1k
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
271 $ fileset -r3 'resolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
272 $ fileset -r3 'unresolved()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
273
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
274 #if execbit
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
275 $ fileset -r1 'exec()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
276 b2
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
277 #endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
278
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
279 #if symlink
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
280 $ fileset -r1 'symlink()'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
281 b2link
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
282 #endif
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
283
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
284 #if no-windows
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
285 $ fileset -r1 'not portable()'
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
286 con.xml
24424
f7a3ea7b9dc6 test-fileset: forget non-portable files to avoid failures on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 24408
diff changeset
287 $ hg forget 'con.xml'
24408
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
288 #endif
caa6b6c65dc3 fileset: add a fileset for portable filenames
Siddharth Agarwal <sid0@fb.com>
parents: 21947
diff changeset
289
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
290 $ fileset -r4 'subrepo("re:su.*")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
291 sub
25558
daf9f7ee2a5c convert: support incremental conversion with hg subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents: 25255
diff changeset
292 sub2
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
293 $ fileset -r4 'subrepo("sub")'
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
294 sub
17371
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
295 $ fileset -r4 'b2 or c1'
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
296 b2
1310489eb5d6 fileset: fix generator vs list bug in fast path
Patrick Mezard <patrick@mezard.eu>
parents: 17370
diff changeset
297 c1
17370
3fe199579323 debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents: 17369
diff changeset
298
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
299 >>> open('dos', 'wb').write("dos\r\n")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
300 >>> open('mixed', 'wb').write("dos\r\nunix\n")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
301 >>> open('mac', 'wb').write("mac\r")
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
302 $ hg add dos mixed mac
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
303
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
304 (remove a1, to examine safety of 'eol' on removed files)
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
305 $ rm a1
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
306
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
307 $ fileset 'eol(dos)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
308 dos
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
309 mixed
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
310 $ fileset 'eol(unix)'
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
311 mixed
18842
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
312 .hgsub
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
313 .hgsubstate
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
314 b1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
315 b2
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
316 c1
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
317 $ fileset 'eol(mac)'
3ce3f2b059a1 filesets: add eol predicate
Matt Mackall <mpm@selenic.com>
parents: 17371
diff changeset
318 mac
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
319
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
320 Test safety of 'encoding' on removed files
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
321
27477
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
322 #if symlink
27459
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
323 $ fileset 'encoding("ascii")'
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
324 dos
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
325 mac
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
326 mixed
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
327 .hgsub
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
328 .hgsubstate
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
329 1k
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
330 2k
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
331 b1
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
332 b2
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
333 b2link
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
334 bin
2f15253e415f fileset: treat encoding and eol as the predicate calling _existing
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27024
diff changeset
335 c1
27477
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
336 #else
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
337 $ fileset 'encoding("ascii")'
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
338 dos
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
339 mac
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
340 mixed
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
341 .hgsub
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
342 .hgsubstate
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
343 1k
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
344 2k
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
345 b1
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
346 b2
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
347 bin
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
348 c1
319d78cf787d test-fileset: conditionalize output with symlink
Matt Harbison <matt_harbison@yahoo.com>
parents: 27464
diff changeset
349 #endif
27464
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
350
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
351 Test detection of unintentional 'matchctx.existing()' invocation
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
352
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
353 $ cat > $TESTTMP/existingcaller.py <<EOF
28447
4eb5496c2bd4 registrar: add filesetpredicate to mark a function as fileset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27518
diff changeset
354 > from mercurial import registrar
27464
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
355 >
28447
4eb5496c2bd4 registrar: add filesetpredicate to mark a function as fileset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27518
diff changeset
356 > filesetpredicate = registrar.filesetpredicate()
4eb5496c2bd4 registrar: add filesetpredicate to mark a function as fileset predicate
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27518
diff changeset
357 > @filesetpredicate('existingcaller()', callexisting=False)
27464
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
358 > def existingcaller(mctx, x):
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
359 > # this 'mctx.existing()' invocation is unintentional
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
360 > return [f for f in mctx.existing()]
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
361 > EOF
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
362
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
363 $ cat >> .hg/hgrc <<EOF
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
364 > [extensions]
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
365 > existingcaller = $TESTTMP/existingcaller.py
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
366 > EOF
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
367
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
368 $ fileset 'existingcaller()' 2>&1 | tail -1
c39ecb2b86b3 fileset: detect unintentional existing() invocation at runtime
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 27459
diff changeset
369 AssertionError: unexpected existing() invocation