Show More
@@ -1,99 +1,176 | |||
|
1 | 1 | $ fileset() { |
|
2 | 2 | > hg debugfileset "$@" |
|
3 | 3 | > } |
|
4 | 4 | |
|
5 | 5 | $ hg init repo |
|
6 | 6 | $ cd repo |
|
7 | 7 | $ echo a > a1 |
|
8 | 8 | $ echo a > a2 |
|
9 | 9 | $ echo b > b1 |
|
10 | 10 | $ echo b > b2 |
|
11 | 11 | $ hg ci -Am addfiles |
|
12 | 12 | adding a1 |
|
13 | 13 | adding a2 |
|
14 | 14 | adding b1 |
|
15 | 15 | adding b2 |
|
16 | 16 | |
|
17 | 17 | Test operators and basic patterns |
|
18 | 18 | |
|
19 | 19 | $ fileset a1 |
|
20 | 20 | a1 |
|
21 | 21 | $ fileset 'a*' |
|
22 | 22 | a1 |
|
23 | 23 | a2 |
|
24 | 24 | $ fileset '"re:a\d"' |
|
25 | 25 | a1 |
|
26 | 26 | a2 |
|
27 | 27 | $ fileset 'a1 or a2' |
|
28 | 28 | a1 |
|
29 | 29 | a2 |
|
30 | 30 | $ fileset 'a1 | a2' |
|
31 | 31 | a1 |
|
32 | 32 | a2 |
|
33 | 33 | $ fileset 'a* and "*1"' |
|
34 | 34 | a1 |
|
35 | 35 | $ fileset 'a* & "*1"' |
|
36 | 36 | a1 |
|
37 | 37 | $ fileset 'not (r"a*")' |
|
38 | 38 | b1 |
|
39 | 39 | b2 |
|
40 | 40 | $ fileset '! ("a*")' |
|
41 | 41 | b1 |
|
42 | 42 | b2 |
|
43 | 43 | $ fileset 'a* - a1' |
|
44 | 44 | a2 |
|
45 | 45 | |
|
46 | 46 | Test files status |
|
47 | 47 | |
|
48 | 48 | $ rm a1 |
|
49 | 49 | $ hg rm a2 |
|
50 | 50 | $ echo b >> b2 |
|
51 | 51 | $ hg cp b1 c1 |
|
52 | 52 | $ echo c > c2 |
|
53 | 53 | $ echo c > c3 |
|
54 | 54 | $ cat > .hgignore <<EOF |
|
55 | 55 | > \.hgignore |
|
56 | 56 | > 2$ |
|
57 | 57 | > EOF |
|
58 | 58 | $ fileset 'modified()' |
|
59 | 59 | b2 |
|
60 | 60 | $ fileset 'added()' |
|
61 | 61 | c1 |
|
62 | 62 | $ fileset 'removed()' |
|
63 | 63 | a2 |
|
64 | 64 | $ fileset 'deleted()' |
|
65 | 65 | a1 |
|
66 | 66 | $ fileset 'unknown()' |
|
67 | 67 | c3 |
|
68 | 68 | $ fileset 'ignored()' |
|
69 | 69 | .hgignore |
|
70 | 70 | c2 |
|
71 | 71 | $ fileset 'hgignore()' |
|
72 | 72 | a2 |
|
73 | 73 | b2 |
|
74 | 74 | $ fileset 'clean()' |
|
75 | 75 | b1 |
|
76 | 76 | $ fileset 'copied()' |
|
77 | 77 | c1 |
|
78 | 78 | |
|
79 | 79 | Test files properties |
|
80 | 80 | |
|
81 | 81 | >>> file('bin', 'wb').write('\0a') |
|
82 | 82 | $ fileset 'binary()' |
|
83 | 83 | $ fileset 'binary() and unknown()' |
|
84 | 84 | bin |
|
85 | 85 | $ echo '^bin$' >> .hgignore |
|
86 | 86 | $ fileset 'binary() and ignored()' |
|
87 | 87 | bin |
|
88 | 88 | $ hg add bin |
|
89 | 89 | $ fileset 'binary()' |
|
90 | 90 | bin |
|
91 | 91 | |
|
92 | 92 | $ fileset 'grep("b{1}")' |
|
93 | 93 | b2 |
|
94 | 94 | c1 |
|
95 | 95 | b1 |
|
96 | 96 | $ fileset 'grep("missingparens(")' |
|
97 | 97 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
98 | 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