Show More
@@ -1,99 +1,176 | |||||
1 | $ fileset() { |
|
1 | $ fileset() { | |
2 | > hg debugfileset "$@" |
|
2 | > hg debugfileset "$@" | |
3 | > } |
|
3 | > } | |
4 |
|
4 | |||
5 | $ hg init repo |
|
5 | $ hg init repo | |
6 | $ cd repo |
|
6 | $ cd repo | |
7 | $ echo a > a1 |
|
7 | $ echo a > a1 | |
8 | $ echo a > a2 |
|
8 | $ echo a > a2 | |
9 | $ echo b > b1 |
|
9 | $ echo b > b1 | |
10 | $ echo b > b2 |
|
10 | $ echo b > b2 | |
11 | $ hg ci -Am addfiles |
|
11 | $ hg ci -Am addfiles | |
12 | adding a1 |
|
12 | adding a1 | |
13 | adding a2 |
|
13 | adding a2 | |
14 | adding b1 |
|
14 | adding b1 | |
15 | adding b2 |
|
15 | adding b2 | |
16 |
|
16 | |||
17 | Test operators and basic patterns |
|
17 | Test operators and basic patterns | |
18 |
|
18 | |||
19 | $ fileset a1 |
|
19 | $ fileset a1 | |
20 | a1 |
|
20 | a1 | |
21 | $ fileset 'a*' |
|
21 | $ fileset 'a*' | |
22 | a1 |
|
22 | a1 | |
23 | a2 |
|
23 | a2 | |
24 | $ fileset '"re:a\d"' |
|
24 | $ fileset '"re:a\d"' | |
25 | a1 |
|
25 | a1 | |
26 | a2 |
|
26 | a2 | |
27 | $ fileset 'a1 or a2' |
|
27 | $ fileset 'a1 or a2' | |
28 | a1 |
|
28 | a1 | |
29 | a2 |
|
29 | a2 | |
30 | $ fileset 'a1 | a2' |
|
30 | $ fileset 'a1 | a2' | |
31 | a1 |
|
31 | a1 | |
32 | a2 |
|
32 | a2 | |
33 | $ fileset 'a* and "*1"' |
|
33 | $ fileset 'a* and "*1"' | |
34 | a1 |
|
34 | a1 | |
35 | $ fileset 'a* & "*1"' |
|
35 | $ fileset 'a* & "*1"' | |
36 | a1 |
|
36 | a1 | |
37 | $ fileset 'not (r"a*")' |
|
37 | $ fileset 'not (r"a*")' | |
38 | b1 |
|
38 | b1 | |
39 | b2 |
|
39 | b2 | |
40 | $ fileset '! ("a*")' |
|
40 | $ fileset '! ("a*")' | |
41 | b1 |
|
41 | b1 | |
42 | b2 |
|
42 | b2 | |
43 | $ fileset 'a* - a1' |
|
43 | $ fileset 'a* - a1' | |
44 | a2 |
|
44 | a2 | |
45 |
|
45 | |||
46 | Test files status |
|
46 | Test files status | |
47 |
|
47 | |||
48 | $ rm a1 |
|
48 | $ rm a1 | |
49 | $ hg rm a2 |
|
49 | $ hg rm a2 | |
50 | $ echo b >> b2 |
|
50 | $ echo b >> b2 | |
51 | $ hg cp b1 c1 |
|
51 | $ hg cp b1 c1 | |
52 | $ echo c > c2 |
|
52 | $ echo c > c2 | |
53 | $ echo c > c3 |
|
53 | $ echo c > c3 | |
54 | $ cat > .hgignore <<EOF |
|
54 | $ cat > .hgignore <<EOF | |
55 | > \.hgignore |
|
55 | > \.hgignore | |
56 | > 2$ |
|
56 | > 2$ | |
57 | > EOF |
|
57 | > EOF | |
58 | $ fileset 'modified()' |
|
58 | $ fileset 'modified()' | |
59 | b2 |
|
59 | b2 | |
60 | $ fileset 'added()' |
|
60 | $ fileset 'added()' | |
61 | c1 |
|
61 | c1 | |
62 | $ fileset 'removed()' |
|
62 | $ fileset 'removed()' | |
63 | a2 |
|
63 | a2 | |
64 | $ fileset 'deleted()' |
|
64 | $ fileset 'deleted()' | |
65 | a1 |
|
65 | a1 | |
66 | $ fileset 'unknown()' |
|
66 | $ fileset 'unknown()' | |
67 | c3 |
|
67 | c3 | |
68 | $ fileset 'ignored()' |
|
68 | $ fileset 'ignored()' | |
69 | .hgignore |
|
69 | .hgignore | |
70 | c2 |
|
70 | c2 | |
71 | $ fileset 'hgignore()' |
|
71 | $ fileset 'hgignore()' | |
72 | a2 |
|
72 | a2 | |
73 | b2 |
|
73 | b2 | |
74 | $ fileset 'clean()' |
|
74 | $ fileset 'clean()' | |
75 | b1 |
|
75 | b1 | |
76 | $ fileset 'copied()' |
|
76 | $ fileset 'copied()' | |
77 | c1 |
|
77 | c1 | |
78 |
|
78 | |||
79 | Test files properties |
|
79 | Test files properties | |
80 |
|
80 | |||
81 | >>> file('bin', 'wb').write('\0a') |
|
81 | >>> file('bin', 'wb').write('\0a') | |
82 | $ fileset 'binary()' |
|
82 | $ fileset 'binary()' | |
83 | $ fileset 'binary() and unknown()' |
|
83 | $ fileset 'binary() and unknown()' | |
84 | bin |
|
84 | bin | |
85 | $ echo '^bin$' >> .hgignore |
|
85 | $ echo '^bin$' >> .hgignore | |
86 | $ fileset 'binary() and ignored()' |
|
86 | $ fileset 'binary() and ignored()' | |
87 | bin |
|
87 | bin | |
88 | $ hg add bin |
|
88 | $ hg add bin | |
89 | $ fileset 'binary()' |
|
89 | $ fileset 'binary()' | |
90 | bin |
|
90 | bin | |
91 |
|
91 | |||
92 | $ fileset 'grep("b{1}")' |
|
92 | $ fileset 'grep("b{1}")' | |
93 | b2 |
|
93 | b2 | |
94 | c1 |
|
94 | c1 | |
95 | b1 |
|
95 | b1 | |
96 | $ fileset 'grep("missingparens(")' |
|
96 | $ fileset 'grep("missingparens(")' | |
97 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
97 | hg: parse error: invalid match pattern: unbalanced parenthesis | |
98 | [255] |
|
98 | [255] | |
99 |
|
99 | |||
|
100 | #if execbit | |||
|
101 | $ chmod +x b2 | |||
|
102 | $ fileset 'exec()' | |||
|
103 | b2 | |||
|
104 | #endif | |||
|
105 | ||||
|
106 | #if symlink | |||
|
107 | $ ln -s b2 b2link | |||
|
108 | $ fileset 'symlink() and unknown()' | |||
|
109 | b2link | |||
|
110 | $ hg add b2link | |||
|
111 | #endif | |||
|
112 | ||||
|
113 | >>> file('1k', 'wb').write(' '*1024) | |||
|
114 | >>> file('2k', 'wb').write(' '*2048) | |||
|
115 | $ hg add 1k 2k | |||
|
116 | $ fileset 'size("bar")' | |||
|
117 | hg: parse error: couldn't parse size: bar | |||
|
118 | [255] | |||
|
119 | $ fileset 'size(1k)' | |||
|
120 | 1k | |||
|
121 | $ fileset '(1k or 2k) and size("< 2k")' | |||
|
122 | 1k | |||
|
123 | $ fileset '(1k or 2k) and size("<=2k")' | |||
|
124 | 1k | |||
|
125 | 2k | |||
|
126 | $ fileset '(1k or 2k) and size("> 1k")' | |||
|
127 | 2k | |||
|
128 | $ fileset '(1k or 2k) and size(">=1K")' | |||
|
129 | 1k | |||
|
130 | 2k | |||
|
131 | $ fileset '(1k or 2k) and size(".5KB - 1.5kB")' | |||
|
132 | 1k | |||
|
133 | ||||
|
134 | Test merge states | |||
|
135 | ||||
|
136 | $ hg ci -m manychanges | |||
|
137 | $ hg up -C 0 | |||
|
138 | * files updated, 0 files merged, * files removed, 0 files unresolved (glob) | |||
|
139 | $ echo c >> b2 | |||
|
140 | $ hg ci -m diverging b2 | |||
|
141 | created new head | |||
|
142 | $ fileset 'resolved()' | |||
|
143 | $ fileset 'unresolved()' | |||
|
144 | $ hg merge | |||
|
145 | merging b2 | |||
|
146 | warning: conflicts during merge. | |||
|
147 | merging b2 incomplete! (edit conflicts, then use 'hg resolve --mark') | |||
|
148 | * files updated, 0 files merged, * files removed, 1 files unresolved (glob) | |||
|
149 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |||
|
150 | [1] | |||
|
151 | $ fileset 'resolved()' | |||
|
152 | $ fileset 'unresolved()' | |||
|
153 | b2 | |||
|
154 | $ echo e > b2 | |||
|
155 | $ hg resolve -m b2 | |||
|
156 | $ fileset 'resolved()' | |||
|
157 | b2 | |||
|
158 | $ fileset 'unresolved()' | |||
|
159 | $ hg ci -m merge | |||
|
160 | ||||
|
161 | Test subrepo predicate | |||
|
162 | ||||
|
163 | $ hg init sub | |||
|
164 | $ echo a > sub/suba | |||
|
165 | $ hg -R sub add sub/suba | |||
|
166 | $ hg -R sub ci -m sub | |||
|
167 | $ echo 'sub = sub' > .hgsub | |||
|
168 | $ fileset 'subrepo()' | |||
|
169 | $ hg add .hgsub | |||
|
170 | $ fileset 'subrepo()' | |||
|
171 | sub | |||
|
172 | $ fileset 'subrepo("sub")' | |||
|
173 | sub | |||
|
174 | $ fileset 'subrepo("glob:*")' | |||
|
175 | sub | |||
|
176 |
General Comments 0
You need to be logged in to leave comments.
Login now