Show More
@@ -1,375 +1,374 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ HGMERGE=true; export HGMERGE |
|
3 | 3 | $ echo '[extensions]' >> $HGRCPATH |
|
4 | 4 | $ echo 'graphlog =' >> $HGRCPATH |
|
5 | 5 | $ echo 'convert =' >> $HGRCPATH |
|
6 | 6 | $ glog() |
|
7 | 7 | > { |
|
8 | 8 | > hg glog --template '{rev} "{desc}" files: {files}\n' "$@" |
|
9 | 9 | > } |
|
10 | 10 | $ hg init source |
|
11 | 11 | $ cd source |
|
12 | 12 | $ echo foo > foo |
|
13 | 13 | $ echo baz > baz |
|
14 | 14 | $ mkdir -p dir/subdir |
|
15 | 15 | $ echo dir/file >> dir/file |
|
16 | 16 | $ echo dir/file2 >> dir/file2 |
|
17 | 17 | $ echo dir/file3 >> dir/file3 # to be corrupted in rev 0 |
|
18 | 18 | $ echo dir/subdir/file3 >> dir/subdir/file3 |
|
19 | 19 | $ echo dir/subdir/file4 >> dir/subdir/file4 |
|
20 | 20 | $ hg ci -d '0 0' -qAm '0: add foo baz dir/' |
|
21 | 21 | $ echo bar > bar |
|
22 | 22 | $ echo quux > quux |
|
23 | 23 | $ echo dir/file4 >> dir/file4 # to be corrupted in rev 1 |
|
24 | 24 | $ hg copy foo copied |
|
25 | 25 | $ hg ci -d '1 0' -qAm '1: add bar quux; copy foo to copied' |
|
26 | 26 | $ echo >> foo |
|
27 | 27 | $ hg ci -d '2 0' -m '2: change foo' |
|
28 | 28 | $ hg up -qC 1 |
|
29 | 29 | $ echo >> bar |
|
30 | 30 | $ echo >> quux |
|
31 | 31 | $ hg ci -d '3 0' -m '3: change bar quux' |
|
32 | 32 | created new head |
|
33 | 33 | $ hg up -qC 2 |
|
34 | 34 | $ hg merge -qr 3 |
|
35 | 35 | $ echo >> bar |
|
36 | 36 | $ echo >> baz |
|
37 | 37 | $ hg ci -d '4 0' -m '4: first merge; change bar baz' |
|
38 | 38 | $ echo >> bar |
|
39 | 39 | $ echo 1 >> baz |
|
40 | 40 | $ echo >> quux |
|
41 | 41 | $ hg ci -d '5 0' -m '5: change bar baz quux' |
|
42 | 42 | $ hg up -qC 4 |
|
43 | 43 | $ echo >> foo |
|
44 | 44 | $ echo 2 >> baz |
|
45 | 45 | $ hg ci -d '6 0' -m '6: change foo baz' |
|
46 | 46 | created new head |
|
47 | 47 | $ hg up -qC 5 |
|
48 | 48 | $ hg merge -qr 6 |
|
49 | 49 | $ echo >> bar |
|
50 | 50 | $ hg ci -d '7 0' -m '7: second merge; change bar' |
|
51 | 51 | $ echo >> foo |
|
52 | 52 | $ hg ci -m '8: change foo' |
|
53 | 53 | $ glog |
|
54 | 54 | @ 8 "8: change foo" files: foo |
|
55 | 55 | | |
|
56 | 56 | o 7 "7: second merge; change bar" files: bar baz |
|
57 | 57 | |\ |
|
58 | 58 | | o 6 "6: change foo baz" files: baz foo |
|
59 | 59 | | | |
|
60 | 60 | o | 5 "5: change bar baz quux" files: bar baz quux |
|
61 | 61 | |/ |
|
62 | 62 | o 4 "4: first merge; change bar baz" files: bar baz |
|
63 | 63 | |\ |
|
64 | 64 | | o 3 "3: change bar quux" files: bar quux |
|
65 | 65 | | | |
|
66 | 66 | o | 2 "2: change foo" files: foo |
|
67 | 67 | |/ |
|
68 | 68 | o 1 "1: add bar quux; copy foo to copied" files: bar copied dir/file4 quux |
|
69 | 69 | | |
|
70 | 70 | o 0 "0: add foo baz dir/" files: baz dir/file dir/file2 dir/file3 dir/subdir/file3 dir/subdir/file4 foo |
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | final file versions in this repo: |
|
74 | 74 | |
|
75 | 75 | $ hg manifest --debug |
|
76 | 76 | 9463f52fe115e377cf2878d4fc548117211063f2 644 bar |
|
77 | 77 | 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz |
|
78 | 78 | 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied |
|
79 | 79 | 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir/file |
|
80 | 80 | 75e6d3f8328f5f6ace6bf10b98df793416a09dca 644 dir/file2 |
|
81 | 81 | e96dce0bc6a217656a3a410e5e6bec2c4f42bf7c 644 dir/file3 |
|
82 | 82 | 6edd55f559cdce67132b12ca09e09cee08b60442 644 dir/file4 |
|
83 | 83 | 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir/subdir/file3 |
|
84 | 84 | 57a1c1511590f3de52874adfa04effe8a77d64af 644 dir/subdir/file4 |
|
85 | 85 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo |
|
86 | 86 | bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux |
|
87 | 87 | $ hg debugrename copied |
|
88 | 88 | copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd |
|
89 | $ echo | |
|
90 | ||
|
89 | ||
|
91 | 90 | $ cd .. |
|
92 | 91 | $ splitrepo() |
|
93 | 92 | > { |
|
94 | 93 | > msg="$1" |
|
95 | 94 | > files="$2" |
|
96 | 95 | > opts=$3 |
|
97 | 96 | > echo "% $files: $msg" |
|
98 | 97 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
99 | 98 | > fmap="$prefix.fmap" |
|
100 | 99 | > repo="$prefix.repo" |
|
101 | 100 | > for i in $files; do |
|
102 | 101 | > echo "include $i" >> "$fmap" |
|
103 | 102 | > done |
|
104 | 103 | > hg -q convert $opts --filemap "$fmap" --datesort source "$repo" |
|
105 | 104 | > hg up -q -R "$repo" |
|
106 | 105 | > glog -R "$repo" |
|
107 | 106 | > hg -R "$repo" manifest --debug |
|
108 | 107 | > } |
|
109 | 108 | $ splitrepo 'skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd' foo |
|
110 | 109 | % foo: skip unwanted merges; use 1st parent in 1st merge, 2nd in 2nd |
|
111 | 110 | @ 3 "8: change foo" files: foo |
|
112 | 111 | | |
|
113 | 112 | o 2 "6: change foo baz" files: foo |
|
114 | 113 | | |
|
115 | 114 | o 1 "2: change foo" files: foo |
|
116 | 115 | | |
|
117 | 116 | o 0 "0: add foo baz dir/" files: foo |
|
118 | 117 | |
|
119 | 118 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo |
|
120 | 119 | $ splitrepo 'merges are not merges anymore' bar |
|
121 | 120 | % bar: merges are not merges anymore |
|
122 | 121 | @ 4 "7: second merge; change bar" files: bar |
|
123 | 122 | | |
|
124 | 123 | o 3 "5: change bar baz quux" files: bar |
|
125 | 124 | | |
|
126 | 125 | o 2 "4: first merge; change bar baz" files: bar |
|
127 | 126 | | |
|
128 | 127 | o 1 "3: change bar quux" files: bar |
|
129 | 128 | | |
|
130 | 129 | o 0 "1: add bar quux; copy foo to copied" files: bar |
|
131 | 130 | |
|
132 | 131 | 9463f52fe115e377cf2878d4fc548117211063f2 644 bar |
|
133 | 132 | $ splitrepo '1st merge is not a merge anymore; 2nd still is' baz |
|
134 | 133 | % baz: 1st merge is not a merge anymore; 2nd still is |
|
135 | 134 | @ 4 "7: second merge; change bar" files: baz |
|
136 | 135 | |\ |
|
137 | 136 | | o 3 "6: change foo baz" files: baz |
|
138 | 137 | | | |
|
139 | 138 | o | 2 "5: change bar baz quux" files: baz |
|
140 | 139 | |/ |
|
141 | 140 | o 1 "4: first merge; change bar baz" files: baz |
|
142 | 141 | | |
|
143 | 142 | o 0 "0: add foo baz dir/" files: baz |
|
144 | 143 | |
|
145 | 144 | 94c1be4dfde2ee8d78db8bbfcf81210813307c3d 644 baz |
|
146 | 145 | $ splitrepo 'we add additional merges when they are interesting' 'foo quux' |
|
147 | 146 | % foo quux: we add additional merges when they are interesting |
|
148 | 147 | @ 8 "8: change foo" files: foo |
|
149 | 148 | | |
|
150 | 149 | o 7 "7: second merge; change bar" files: |
|
151 | 150 | |\ |
|
152 | 151 | | o 6 "6: change foo baz" files: foo |
|
153 | 152 | | | |
|
154 | 153 | o | 5 "5: change bar baz quux" files: quux |
|
155 | 154 | |/ |
|
156 | 155 | o 4 "4: first merge; change bar baz" files: |
|
157 | 156 | |\ |
|
158 | 157 | | o 3 "3: change bar quux" files: quux |
|
159 | 158 | | | |
|
160 | 159 | o | 2 "2: change foo" files: foo |
|
161 | 160 | |/ |
|
162 | 161 | o 1 "1: add bar quux; copy foo to copied" files: quux |
|
163 | 162 | | |
|
164 | 163 | o 0 "0: add foo baz dir/" files: foo |
|
165 | 164 | |
|
166 | 165 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo |
|
167 | 166 | bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux |
|
168 | 167 | $ splitrepo 'partial conversion' 'bar quux' '-r 3' |
|
169 | 168 | % bar quux: partial conversion |
|
170 | 169 | @ 1 "3: change bar quux" files: bar quux |
|
171 | 170 | | |
|
172 | 171 | o 0 "1: add bar quux; copy foo to copied" files: bar quux |
|
173 | 172 | |
|
174 | 173 | b79105bedc55102f394e90a789c9c380117c1b4a 644 bar |
|
175 | 174 | db0421cc6b685a458c8d86c7d5c004f94429ea23 644 quux |
|
176 | 175 | $ splitrepo 'complete the partial conversion' 'bar quux' |
|
177 | 176 | % bar quux: complete the partial conversion |
|
178 | 177 | @ 4 "7: second merge; change bar" files: bar |
|
179 | 178 | | |
|
180 | 179 | o 3 "5: change bar baz quux" files: bar quux |
|
181 | 180 | | |
|
182 | 181 | o 2 "4: first merge; change bar baz" files: bar |
|
183 | 182 | | |
|
184 | 183 | o 1 "3: change bar quux" files: bar quux |
|
185 | 184 | | |
|
186 | 185 | o 0 "1: add bar quux; copy foo to copied" files: bar quux |
|
187 | 186 | |
|
188 | 187 | 9463f52fe115e377cf2878d4fc548117211063f2 644 bar |
|
189 | 188 | bc3eca3f47023a3e70ca0d8cc95a22a6827db19d 644 quux |
|
190 | 189 | $ rm -r foo.repo |
|
191 | 190 | $ splitrepo 'partial conversion' 'foo' '-r 3' |
|
192 | 191 | % foo: partial conversion |
|
193 | 192 | @ 0 "0: add foo baz dir/" files: foo |
|
194 | 193 | |
|
195 | 194 | 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo |
|
196 | 195 | $ splitrepo 'complete the partial conversion' 'foo' |
|
197 | 196 | % foo: complete the partial conversion |
|
198 | 197 | @ 3 "8: change foo" files: foo |
|
199 | 198 | | |
|
200 | 199 | o 2 "6: change foo baz" files: foo |
|
201 | 200 | | |
|
202 | 201 | o 1 "2: change foo" files: foo |
|
203 | 202 | | |
|
204 | 203 | o 0 "0: add foo baz dir/" files: foo |
|
205 | 204 | |
|
206 | 205 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo |
|
207 | 206 | $ splitrepo 'copied file; source not included in new repo' copied |
|
208 | 207 | % copied: copied file; source not included in new repo |
|
209 | 208 | @ 0 "1: add bar quux; copy foo to copied" files: copied |
|
210 | 209 | |
|
211 | 210 | 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 copied |
|
212 | 211 | $ hg --cwd copied.repo debugrename copied |
|
213 | 212 | copied not renamed |
|
214 | 213 | $ splitrepo 'copied file; source included in new repo' 'foo copied' |
|
215 | 214 | % foo copied: copied file; source included in new repo |
|
216 | 215 | @ 4 "8: change foo" files: foo |
|
217 | 216 | | |
|
218 | 217 | o 3 "6: change foo baz" files: foo |
|
219 | 218 | | |
|
220 | 219 | o 2 "2: change foo" files: foo |
|
221 | 220 | | |
|
222 | 221 | o 1 "1: add bar quux; copy foo to copied" files: copied |
|
223 | 222 | | |
|
224 | 223 | o 0 "0: add foo baz dir/" files: foo |
|
225 | 224 | |
|
226 | 225 | 7711d36246cc83e61fb29cd6d4ef394c63f1ceaf 644 copied |
|
227 | 226 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo |
|
228 | 227 | $ hg --cwd foo-copied.repo debugrename copied |
|
229 | 228 | copied renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd |
|
230 | 229 | $ cat > renames.fmap <<EOF |
|
231 | 230 | > include dir |
|
232 | 231 | > exclude dir/file2 |
|
233 | 232 | > rename dir dir2 |
|
234 | 233 | > include foo |
|
235 | 234 | > include copied |
|
236 | 235 | > rename foo foo2 |
|
237 | 236 | > rename copied copied2 |
|
238 | 237 | > exclude dir/subdir |
|
239 | 238 | > include dir/subdir/file3 |
|
240 | 239 | > EOF |
|
241 | 240 | $ rm source/.hg/store/data/dir/file3.i |
|
242 | 241 | $ rm source/.hg/store/data/dir/file4.i |
|
243 | 242 | $ hg -q convert --filemap renames.fmap --datesort source dummydest |
|
244 | 243 | abort: data/dir/file3.i@e96dce0bc6a2: no match found! |
|
245 | 244 | [255] |
|
246 | 245 | $ hg -q convert --filemap renames.fmap --datesort --config convert.hg.ignoreerrors=1 source renames.repo |
|
247 | 246 | ignoring: data/dir/file3.i@e96dce0bc6a2: no match found |
|
248 | 247 | ignoring: data/dir/file4.i@6edd55f559cd: no match found |
|
249 | 248 | $ hg up -q -R renames.repo |
|
250 | 249 | $ glog -R renames.repo |
|
251 | 250 | @ 4 "8: change foo" files: foo2 |
|
252 | 251 | | |
|
253 | 252 | o 3 "6: change foo baz" files: foo2 |
|
254 | 253 | | |
|
255 | 254 | o 2 "2: change foo" files: foo2 |
|
256 | 255 | | |
|
257 | 256 | o 1 "1: add bar quux; copy foo to copied" files: copied2 |
|
258 | 257 | | |
|
259 | 258 | o 0 "0: add foo baz dir/" files: dir2/file dir2/subdir/file3 foo2 |
|
260 | 259 | |
|
261 | 260 | $ hg -R renames.repo manifest --debug |
|
262 | 261 | d43feacba7a4f1f2080dde4a4b985bd8a0236d46 644 copied2 |
|
263 | 262 | 3e20847584beff41d7cd16136b7331ab3d754be0 644 dir2/file |
|
264 | 263 | 5fe139720576e18e34bcc9f79174db8897c8afe9 644 dir2/subdir/file3 |
|
265 | 264 | 9a7b52012991e4873687192c3e17e61ba3e837a3 644 foo2 |
|
266 | 265 | $ hg --cwd renames.repo debugrename copied2 |
|
267 | 266 | copied2 renamed from foo2:2ed2a3912a0b24502043eae84ee4b279c18b90dd |
|
268 | 267 | |
|
269 | 268 | copied: |
|
270 | 269 | |
|
271 | 270 | $ hg --cwd source cat copied |
|
272 | 271 | foo |
|
273 | 272 | |
|
274 | 273 | copied2: |
|
275 | 274 | |
|
276 | 275 | $ hg --cwd renames.repo cat copied2 |
|
277 | 276 | foo |
|
278 | 277 | |
|
279 | 278 | filemap errors |
|
280 | 279 | |
|
281 | 280 | $ cat > errors.fmap <<EOF |
|
282 | 281 | > include dir/ # beware that comments changes error line numbers! |
|
283 | 282 | > exclude /dir |
|
284 | 283 | > rename dir//dir /dir//dir/ "out of sync" |
|
285 | 284 | > include |
|
286 | 285 | > EOF |
|
287 | 286 | $ hg -q convert --filemap errors.fmap source errors.repo |
|
288 | 287 | errors.fmap:1: superfluous / in exclude 'dir/' |
|
289 | 288 | errors.fmap:3: superfluous / in include '/dir' |
|
290 | 289 | errors.fmap:3: superfluous / in rename '/dir' |
|
291 | 290 | errors.fmap:3: superfluous / in exclude 'dir//dir' |
|
292 | 291 | errors.fmap:4: unknown directive 'out of sync' |
|
293 | 292 | errors.fmap:5: path to exclude is missing |
|
294 | 293 | abort: errors in filemap |
|
295 | 294 | [255] |
|
296 | 295 | |
|
297 | 296 | test branch closing revision pruning if branch is pruned |
|
298 | 297 | |
|
299 | 298 | $ hg init branchpruning |
|
300 | 299 | $ cd branchpruning |
|
301 | 300 | $ hg branch foo |
|
302 | 301 | marked working directory as branch foo |
|
303 | 302 | $ echo a > a |
|
304 | 303 | $ hg ci -Am adda |
|
305 | 304 | adding a |
|
306 | 305 | $ hg ci --close-branch -m closefoo |
|
307 | 306 | $ hg up 0 |
|
308 | 307 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
309 | 308 | $ hg branch empty |
|
310 | 309 | marked working directory as branch empty |
|
311 | 310 | $ hg ci -m emptybranch |
|
312 | 311 | $ hg ci --close-branch -m closeempty |
|
313 | 312 | $ hg up 0 |
|
314 | 313 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
315 | 314 | $ hg branch default |
|
316 | 315 | marked working directory as branch default |
|
317 | 316 | $ echo b > b |
|
318 | 317 | $ hg ci -Am addb |
|
319 | 318 | adding b |
|
320 | 319 | $ hg ci --close-branch -m closedefault |
|
321 | 320 | $ cat > filemap <<EOF |
|
322 | 321 | > include b |
|
323 | 322 | > EOF |
|
324 | 323 | $ cd .. |
|
325 | 324 | $ hg convert branchpruning branchpruning-hg1 |
|
326 | 325 | initializing destination branchpruning-hg1 repository |
|
327 | 326 | scanning source... |
|
328 | 327 | sorting... |
|
329 | 328 | converting... |
|
330 | 329 | 5 adda |
|
331 | 330 | 4 closefoo |
|
332 | 331 | 3 emptybranch |
|
333 | 332 | 2 closeempty |
|
334 | 333 | 1 addb |
|
335 | 334 | 0 closedefault |
|
336 | 335 | $ glog -R branchpruning-hg1 |
|
337 | 336 | o 5 "closedefault" files: |
|
338 | 337 | | |
|
339 | 338 | o 4 "addb" files: b |
|
340 | 339 | | |
|
341 | 340 | | o 3 "closeempty" files: |
|
342 | 341 | | | |
|
343 | 342 | | o 2 "emptybranch" files: |
|
344 | 343 | |/ |
|
345 | 344 | | o 1 "closefoo" files: |
|
346 | 345 | |/ |
|
347 | 346 | o 0 "adda" files: a |
|
348 | 347 | |
|
349 | 348 | |
|
350 | 349 | exercise incremental conversion at the same time |
|
351 | 350 | |
|
352 | 351 | $ hg convert -r0 --filemap branchpruning/filemap branchpruning branchpruning-hg2 |
|
353 | 352 | initializing destination branchpruning-hg2 repository |
|
354 | 353 | scanning source... |
|
355 | 354 | sorting... |
|
356 | 355 | converting... |
|
357 | 356 | 0 adda |
|
358 | 357 | $ hg convert -r4 --filemap branchpruning/filemap branchpruning branchpruning-hg2 |
|
359 | 358 | scanning source... |
|
360 | 359 | sorting... |
|
361 | 360 | converting... |
|
362 | 361 | 0 addb |
|
363 | 362 | $ hg convert --filemap branchpruning/filemap branchpruning branchpruning-hg2 |
|
364 | 363 | scanning source... |
|
365 | 364 | sorting... |
|
366 | 365 | converting... |
|
367 | 366 | 3 closefoo |
|
368 | 367 | 2 emptybranch |
|
369 | 368 | 1 closeempty |
|
370 | 369 | 0 closedefault |
|
371 | 370 | $ glog -R branchpruning-hg2 |
|
372 | 371 | o 1 "closedefault" files: |
|
373 | 372 | | |
|
374 | 373 | o 0 "addb" files: b |
|
375 | 374 |
@@ -1,297 +1,293 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ "$TESTDIR/hghave" git || exit 80 |
|
3 | 3 | $ echo "[extensions]" >> $HGRCPATH |
|
4 | 4 | $ echo "convert=" >> $HGRCPATH |
|
5 | 5 | $ echo 'hgext.graphlog =' >> $HGRCPATH |
|
6 | 6 | $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME |
|
7 | 7 | $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL |
|
8 | 8 | $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE |
|
9 | 9 | $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME |
|
10 | 10 | $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL |
|
11 | 11 | $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE |
|
12 | 12 | $ count=10 |
|
13 | 13 | $ commit() |
|
14 | 14 | > { |
|
15 | 15 | > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" |
|
16 | 16 | > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" |
|
17 | 17 | > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" |
|
18 | 18 | > count=`expr $count + 1` |
|
19 | 19 | > } |
|
20 | 20 | $ mkdir git-repo |
|
21 | 21 | $ cd git-repo |
|
22 | 22 | $ git init-db >/dev/null 2>/dev/null |
|
23 | 23 | $ echo a > a |
|
24 | 24 | $ mkdir d |
|
25 | 25 | $ echo b > d/b |
|
26 | 26 | $ git add a d |
|
27 | 27 | $ commit -a -m t1 |
|
28 | 28 | |
|
29 | 29 | Remove the directory, then try to replace it with a file |
|
30 | 30 | (issue 754) |
|
31 | 31 | |
|
32 | 32 | $ git rm -f d/b |
|
33 | 33 | rm 'd/b' |
|
34 | 34 | $ commit -m t2 |
|
35 | 35 | $ echo d > d |
|
36 | 36 | $ git add d |
|
37 | 37 | $ commit -m t3 |
|
38 | 38 | $ echo b >> a |
|
39 | 39 | $ commit -a -m t4.1 |
|
40 | 40 | $ git checkout -b other HEAD~ >/dev/null 2>/dev/null |
|
41 | 41 | $ echo c > a |
|
42 | 42 | $ echo a >> a |
|
43 | 43 | $ commit -a -m t4.2 |
|
44 | 44 | $ git checkout master >/dev/null 2>/dev/null |
|
45 | 45 | $ git pull --no-commit . other > /dev/null 2>/dev/null |
|
46 | 46 | $ commit -m 'Merge branch other' |
|
47 | 47 | $ cd .. |
|
48 | 48 | $ hg convert --datesort git-repo |
|
49 | 49 | assuming destination git-repo-hg |
|
50 | 50 | initializing destination git-repo-hg repository |
|
51 | 51 | scanning source... |
|
52 | 52 | sorting... |
|
53 | 53 | converting... |
|
54 | 54 | 5 t1 |
|
55 | 55 | 4 t2 |
|
56 | 56 | 3 t3 |
|
57 | 57 | 2 t4.1 |
|
58 | 58 | 1 t4.2 |
|
59 | 59 | 0 Merge branch other |
|
60 | 60 | updating bookmarks |
|
61 | 61 | $ hg up -q -R git-repo-hg |
|
62 | 62 | $ hg -R git-repo-hg tip -v |
|
63 | 63 | changeset: 5:c78094926be2 |
|
64 | 64 | bookmark: master |
|
65 | 65 | tag: tip |
|
66 | 66 | parent: 3:f5f5cb45432b |
|
67 | 67 | parent: 4:4e174f80c67c |
|
68 | 68 | user: test <test@example.org> |
|
69 | 69 | date: Mon Jan 01 00:00:15 2007 +0000 |
|
70 | 70 | files: a |
|
71 | 71 | description: |
|
72 | 72 | Merge branch other |
|
73 | 73 | |
|
74 | 74 | |
|
75 | 75 | $ count=10 |
|
76 | 76 | $ mkdir git-repo2 |
|
77 | 77 | $ cd git-repo2 |
|
78 | 78 | $ git init-db >/dev/null 2>/dev/null |
|
79 | 79 | $ echo foo > foo |
|
80 | 80 | $ git add foo |
|
81 | 81 | $ commit -a -m 'add foo' |
|
82 | 82 | $ echo >> foo |
|
83 | 83 | $ commit -a -m 'change foo' |
|
84 | 84 | $ git checkout -b Bar HEAD~ >/dev/null 2>/dev/null |
|
85 | 85 | $ echo quux >> quux |
|
86 | 86 | $ git add quux |
|
87 | 87 | $ commit -a -m 'add quux' |
|
88 | 88 | $ echo bar > bar |
|
89 | 89 | $ git add bar |
|
90 | 90 | $ commit -a -m 'add bar' |
|
91 | 91 | $ git checkout -b Baz HEAD~ >/dev/null 2>/dev/null |
|
92 | 92 | $ echo baz > baz |
|
93 | 93 | $ git add baz |
|
94 | 94 | $ commit -a -m 'add baz' |
|
95 | 95 | $ git checkout master >/dev/null 2>/dev/null |
|
96 | 96 | $ git pull --no-commit . Bar Baz > /dev/null 2>/dev/null |
|
97 | 97 | $ commit -m 'Octopus merge' |
|
98 | 98 | $ echo bar >> bar |
|
99 | 99 | $ commit -a -m 'change bar' |
|
100 | 100 | $ git checkout -b Foo HEAD~ >/dev/null 2>/dev/null |
|
101 | 101 | $ echo >> foo |
|
102 | 102 | $ commit -a -m 'change foo' |
|
103 | 103 | $ git checkout master >/dev/null 2>/dev/null |
|
104 | 104 | $ git pull --no-commit -s ours . Foo > /dev/null 2>/dev/null |
|
105 | 105 | $ commit -m 'Discard change to foo' |
|
106 | 106 | $ cd .. |
|
107 | 107 | $ glog() |
|
108 | 108 | > { |
|
109 | 109 | > hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@" |
|
110 | 110 | > } |
|
111 | 111 | $ splitrepo() |
|
112 | 112 | > { |
|
113 | 113 | > msg="$1" |
|
114 | 114 | > files="$2" |
|
115 | 115 | > opts=$3 |
|
116 | 116 | > echo "% $files: $msg" |
|
117 | 117 | > prefix=`echo "$files" | sed -e 's/ /-/g'` |
|
118 | 118 | > fmap="$prefix.fmap" |
|
119 | 119 | > repo="$prefix.repo" |
|
120 | 120 | > for i in $files; do |
|
121 | 121 | > echo "include $i" >> "$fmap" |
|
122 | 122 | > done |
|
123 | 123 | > hg -q convert $opts --filemap "$fmap" --datesort git-repo2 "$repo" |
|
124 | 124 | > hg up -q -R "$repo" |
|
125 | 125 | > glog -R "$repo" |
|
126 | 126 | > hg -R "$repo" manifest --debug |
|
127 | 127 | > } |
|
128 | 128 | |
|
129 | 129 | full conversion |
|
130 | 130 | |
|
131 | 131 | $ hg -q convert --datesort git-repo2 fullrepo |
|
132 | 132 | $ hg up -q -R fullrepo |
|
133 | 133 | $ glog -R fullrepo |
|
134 | 134 | @ 9 "Discard change to foo" files: foo |
|
135 | 135 | |\ |
|
136 | 136 | | o 8 "change foo" files: foo |
|
137 | 137 | | | |
|
138 | 138 | o | 7 "change bar" files: bar |
|
139 | 139 | |/ |
|
140 | 140 | o 6 "(octopus merge fixup)" files: |
|
141 | 141 | |\ |
|
142 | 142 | | o 5 "Octopus merge" files: baz |
|
143 | 143 | | |\ |
|
144 | 144 | o | | 4 "add baz" files: baz |
|
145 | 145 | | | | |
|
146 | 146 | +---o 3 "add bar" files: bar |
|
147 | 147 | | | |
|
148 | 148 | o | 2 "add quux" files: quux |
|
149 | 149 | | | |
|
150 | 150 | | o 1 "change foo" files: foo |
|
151 | 151 | |/ |
|
152 | 152 | o 0 "add foo" files: foo |
|
153 | 153 | |
|
154 | 154 | $ hg -R fullrepo manifest --debug |
|
155 | 155 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
156 | 156 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
157 | 157 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
158 | 158 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
159 | 159 | $ splitrepo 'octopus merge' 'foo bar baz' |
|
160 | 160 | % foo bar baz: octopus merge |
|
161 | 161 | @ 8 "Discard change to foo" files: foo |
|
162 | 162 | |\ |
|
163 | 163 | | o 7 "change foo" files: foo |
|
164 | 164 | | | |
|
165 | 165 | o | 6 "change bar" files: bar |
|
166 | 166 | |/ |
|
167 | 167 | o 5 "(octopus merge fixup)" files: |
|
168 | 168 | |\ |
|
169 | 169 | | o 4 "Octopus merge" files: baz |
|
170 | 170 | | |\ |
|
171 | 171 | o | | 3 "add baz" files: baz |
|
172 | 172 | | | | |
|
173 | 173 | +---o 2 "add bar" files: bar |
|
174 | 174 | | | |
|
175 | 175 | | o 1 "change foo" files: foo |
|
176 | 176 | |/ |
|
177 | 177 | o 0 "add foo" files: foo |
|
178 | 178 | |
|
179 | 179 | 245a3b8bc653999c2b22cdabd517ccb47aecafdf 644 bar |
|
180 | 180 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
181 | 181 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
182 | 182 | $ splitrepo 'only some parents of an octopus merge; "discard" a head' 'foo baz quux' |
|
183 | 183 | % foo baz quux: only some parents of an octopus merge; "discard" a head |
|
184 | 184 | @ 6 "Discard change to foo" files: foo |
|
185 | 185 | | |
|
186 | 186 | o 5 "change foo" files: foo |
|
187 | 187 | | |
|
188 | 188 | o 4 "Octopus merge" files: |
|
189 | 189 | |\ |
|
190 | 190 | | o 3 "add baz" files: baz |
|
191 | 191 | | | |
|
192 | 192 | | o 2 "add quux" files: quux |
|
193 | 193 | | | |
|
194 | 194 | o | 1 "change foo" files: foo |
|
195 | 195 | |/ |
|
196 | 196 | o 0 "add foo" files: foo |
|
197 | 197 | |
|
198 | 198 | 354ae8da6e890359ef49ade27b68bbc361f3ca88 644 baz |
|
199 | 199 | 9277c9cc8dd4576fc01a17939b4351e5ada93466 644 foo |
|
200 | 200 | 88dfeab657e8cf2cef3dec67b914f49791ae76b1 644 quux |
|
201 | $ echo | |
|
202 | ||
|
203 | 201 | |
|
204 | 202 | test binary conversion (issue 1359) |
|
205 | 203 | |
|
206 | 204 | $ mkdir git-repo3 |
|
207 | 205 | $ cd git-repo3 |
|
208 | 206 | $ git init-db >/dev/null 2>/dev/null |
|
209 | 207 | $ python -c 'file("b", "wb").write("".join([chr(i) for i in range(256)])*16)' |
|
210 | 208 | $ git add b |
|
211 | 209 | $ commit -a -m addbinary |
|
212 | 210 | $ cd .. |
|
213 | 211 | |
|
214 | 212 | convert binary file |
|
215 | 213 | |
|
216 | 214 | $ hg convert git-repo3 git-repo3-hg |
|
217 | 215 | initializing destination git-repo3-hg repository |
|
218 | 216 | scanning source... |
|
219 | 217 | sorting... |
|
220 | 218 | converting... |
|
221 | 219 | 0 addbinary |
|
222 | 220 | updating bookmarks |
|
223 | 221 | $ cd git-repo3-hg |
|
224 | 222 | $ hg up -C |
|
225 | 223 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
226 | 224 | $ python -c 'print len(file("b", "rb").read())' |
|
227 | 225 | 4096 |
|
228 | 226 | $ cd .. |
|
229 | $ echo | |
|
230 | ||
|
231 | 227 | |
|
232 | 228 | test author vs committer |
|
233 | 229 | |
|
234 | 230 | $ mkdir git-repo4 |
|
235 | 231 | $ cd git-repo4 |
|
236 | 232 | $ git init-db >/dev/null 2>/dev/null |
|
237 | 233 | $ echo >> foo |
|
238 | 234 | $ git add foo |
|
239 | 235 | $ commit -a -m addfoo |
|
240 | 236 | $ echo >> foo |
|
241 | 237 | $ GIT_AUTHOR_NAME="nottest" |
|
242 | 238 | $ commit -a -m addfoo2 |
|
243 | 239 | $ cd .. |
|
244 | 240 | |
|
245 | 241 | convert author committer |
|
246 | 242 | |
|
247 | 243 | $ hg convert git-repo4 git-repo4-hg |
|
248 | 244 | initializing destination git-repo4-hg repository |
|
249 | 245 | scanning source... |
|
250 | 246 | sorting... |
|
251 | 247 | converting... |
|
252 | 248 | 1 addfoo |
|
253 | 249 | 0 addfoo2 |
|
254 | 250 | updating bookmarks |
|
255 | 251 | $ hg -R git-repo4-hg log -v |
|
256 | 252 | changeset: 1:d63e967f93da |
|
257 | 253 | bookmark: master |
|
258 | 254 | tag: tip |
|
259 | 255 | user: nottest <test@example.org> |
|
260 | 256 | date: Mon Jan 01 00:00:21 2007 +0000 |
|
261 | 257 | files: foo |
|
262 | 258 | description: |
|
263 | 259 | addfoo2 |
|
264 | 260 | |
|
265 | 261 | committer: test <test@example.org> |
|
266 | 262 | |
|
267 | 263 | |
|
268 | 264 | changeset: 0:0735477b0224 |
|
269 | 265 | user: test <test@example.org> |
|
270 | 266 | date: Mon Jan 01 00:00:20 2007 +0000 |
|
271 | 267 | files: foo |
|
272 | 268 | description: |
|
273 | 269 | addfoo |
|
274 | 270 | |
|
275 | 271 | |
|
276 | 272 | |
|
277 | 273 | --sourceorder should fail |
|
278 | 274 | |
|
279 | 275 | $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg |
|
280 | 276 | initializing destination git-repo4-sourcesort-hg repository |
|
281 | 277 | abort: --sourcesort is not supported by this data source |
|
282 | 278 | [255] |
|
283 | 279 | |
|
284 | 280 | damage git repository and convert again |
|
285 | 281 | |
|
286 | 282 | $ cat > damage.py <<EOF |
|
287 | 283 | > import os |
|
288 | 284 | > for root, dirs, files in os.walk('git-repo4/.git/objects'): |
|
289 | 285 | > if files: |
|
290 | 286 | > path = os.path.join(root, files[0]) |
|
291 | 287 | > os.remove(path) |
|
292 | 288 | > break |
|
293 | 289 | > EOF |
|
294 | 290 | $ python damage.py |
|
295 | 291 | $ hg convert git-repo4 git-repo4-broken-hg 2>&1 | \ |
|
296 | 292 | > grep 'abort:' | sed 's/abort:.*/abort:/g' |
|
297 | 293 | abort: |
@@ -1,548 +1,549 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ "$TESTDIR/hghave" svn no-outer-repo || exit 80 |
|
3 | 3 | |
|
4 | 4 | $ fixpath() |
|
5 | 5 | > { |
|
6 | 6 | > tr '\\' / |
|
7 | 7 | > } |
|
8 | 8 | $ svnupanddisplay() |
|
9 | 9 | > { |
|
10 | 10 | > ( |
|
11 | 11 | > cd $1; |
|
12 | 12 | > svn up; |
|
13 | 13 | > svn st -v | fixpath | sed 's/ */ /g' |
|
14 | 14 | > limit='' |
|
15 | 15 | > if [ $2 -gt 0 ]; then |
|
16 | 16 | > limit="--limit=$2" |
|
17 | 17 | > fi |
|
18 | 18 | > svn log --xml -v $limit \ |
|
19 | 19 | > | fixpath \ |
|
20 | 20 | > | sed 's,<date>.*,<date/>,' \ |
|
21 | 21 | > | grep -v 'kind="' |
|
22 | 22 | > ) |
|
23 | 23 | > } |
|
24 | 24 | |
|
25 | 25 | $ cat >> $HGRCPATH <<EOF |
|
26 | 26 | > [extensions] |
|
27 | 27 | > convert = |
|
28 | 28 | > graphlog = |
|
29 | 29 | > EOF |
|
30 | 30 | |
|
31 | 31 | $ hg init a |
|
32 | 32 | |
|
33 | 33 | Add |
|
34 | 34 | |
|
35 | 35 | $ echo a > a/a |
|
36 | 36 | $ mkdir -p a/d1/d2 |
|
37 | 37 | $ echo b > a/d1/d2/b |
|
38 | 38 | $ ln -s a/missing a/link |
|
39 | 39 | $ hg --cwd a ci -d '0 0' -A -m 'add a file' |
|
40 | 40 | adding a |
|
41 | 41 | adding d1/d2/b |
|
42 | 42 | adding link |
|
43 | 43 | |
|
44 | 44 | Modify |
|
45 | 45 | |
|
46 | 46 | $ "$TESTDIR/svn-safe-append.py" a a/a |
|
47 | 47 | $ hg --cwd a ci -d '1 0' -m 'modify a file' |
|
48 | 48 | $ hg --cwd a tip -q |
|
49 | 49 | 1:8231f652da37 |
|
50 | 50 | |
|
51 | 51 | $ hg convert -d svn a |
|
52 | 52 | assuming destination a-hg |
|
53 | 53 | initializing svn repository 'a-hg' |
|
54 | 54 | initializing svn working copy 'a-hg-wc' |
|
55 | 55 | scanning source... |
|
56 | 56 | sorting... |
|
57 | 57 | converting... |
|
58 | 58 | 1 add a file |
|
59 | 59 | 0 modify a file |
|
60 | 60 | $ svnupanddisplay a-hg-wc 2 |
|
61 | 61 | At revision 2. |
|
62 | 62 | 2 2 test . |
|
63 | 63 | 2 2 test a |
|
64 | 64 | 2 1 test d1 |
|
65 | 65 | 2 1 test d1/d2 |
|
66 | 66 | 2 1 test d1/d2/b |
|
67 | 67 | 2 1 test link |
|
68 | 68 | <?xml version="1.0"?> |
|
69 | 69 | <log> |
|
70 | 70 | <logentry |
|
71 | 71 | revision="2"> |
|
72 | 72 | <author>test</author> |
|
73 | 73 | <date/> |
|
74 | 74 | <paths> |
|
75 | 75 | <path |
|
76 | 76 | action="M">/a</path> |
|
77 | 77 | </paths> |
|
78 | 78 | <msg>modify a file</msg> |
|
79 | 79 | </logentry> |
|
80 | 80 | <logentry |
|
81 | 81 | revision="1"> |
|
82 | 82 | <author>test</author> |
|
83 | 83 | <date/> |
|
84 | 84 | <paths> |
|
85 | 85 | <path |
|
86 | 86 | action="A">/a</path> |
|
87 | 87 | <path |
|
88 | 88 | action="A">/d1</path> |
|
89 | 89 | <path |
|
90 | 90 | action="A">/d1/d2</path> |
|
91 | 91 | <path |
|
92 | 92 | action="A">/d1/d2/b</path> |
|
93 | 93 | <path |
|
94 | 94 | action="A">/link</path> |
|
95 | 95 | </paths> |
|
96 | 96 | <msg>add a file</msg> |
|
97 | 97 | </logentry> |
|
98 | 98 | </log> |
|
99 | 99 | $ ls a a-hg-wc |
|
100 | 100 | a: |
|
101 | 101 | a |
|
102 | 102 | d1 |
|
103 | 103 | link |
|
104 | 104 | |
|
105 | 105 | a-hg-wc: |
|
106 | 106 | a |
|
107 | 107 | d1 |
|
108 | 108 | link |
|
109 | 109 | $ cmp a/a a-hg-wc/a |
|
110 | 110 | |
|
111 | 111 | Rename |
|
112 | 112 | |
|
113 | 113 | $ hg --cwd a mv a b |
|
114 | 114 | $ hg --cwd a mv link newlink |
|
115 | 115 | |
|
116 | 116 | $ hg --cwd a ci -d '2 0' -m 'rename a file' |
|
117 | 117 | $ hg --cwd a tip -q |
|
118 | 118 | 2:a67e26ccec09 |
|
119 | 119 | |
|
120 | 120 | $ hg convert -d svn a |
|
121 | 121 | assuming destination a-hg |
|
122 | 122 | initializing svn working copy 'a-hg-wc' |
|
123 | 123 | scanning source... |
|
124 | 124 | sorting... |
|
125 | 125 | converting... |
|
126 | 126 | 0 rename a file |
|
127 | 127 | $ svnupanddisplay a-hg-wc 1 |
|
128 | 128 | At revision 3. |
|
129 | 129 | 3 3 test . |
|
130 | 130 | 3 3 test b |
|
131 | 131 | 3 1 test d1 |
|
132 | 132 | 3 1 test d1/d2 |
|
133 | 133 | 3 1 test d1/d2/b |
|
134 | 134 | 3 3 test newlink |
|
135 | 135 | <?xml version="1.0"?> |
|
136 | 136 | <log> |
|
137 | 137 | <logentry |
|
138 | 138 | revision="3"> |
|
139 | 139 | <author>test</author> |
|
140 | 140 | <date/> |
|
141 | 141 | <paths> |
|
142 | 142 | <path |
|
143 | 143 | action="D">/a</path> |
|
144 | 144 | <path |
|
145 | 145 | copyfrom-path="/a" |
|
146 | 146 | copyfrom-rev="2" |
|
147 | 147 | action="A">/b</path> |
|
148 | 148 | <path |
|
149 | 149 | copyfrom-path="/link" |
|
150 | 150 | copyfrom-rev="2" |
|
151 | 151 | action="A">/newlink</path> |
|
152 | 152 | <path |
|
153 | 153 | action="D">/link</path> |
|
154 | 154 | </paths> |
|
155 | 155 | <msg>rename a file</msg> |
|
156 | 156 | </logentry> |
|
157 | 157 | </log> |
|
158 | 158 | $ ls a a-hg-wc |
|
159 | 159 | a: |
|
160 | 160 | b |
|
161 | 161 | d1 |
|
162 | 162 | newlink |
|
163 | 163 | |
|
164 | 164 | a-hg-wc: |
|
165 | 165 | b |
|
166 | 166 | d1 |
|
167 | 167 | newlink |
|
168 | 168 | |
|
169 | 169 | Copy |
|
170 | 170 | |
|
171 | 171 | $ hg --cwd a cp b c |
|
172 | 172 | |
|
173 | 173 | $ hg --cwd a ci -d '3 0' -m 'copy a file' |
|
174 | 174 | $ hg --cwd a tip -q |
|
175 | 175 | 3:0cf087b9ab02 |
|
176 | 176 | |
|
177 | 177 | $ hg convert -d svn a |
|
178 | 178 | assuming destination a-hg |
|
179 | 179 | initializing svn working copy 'a-hg-wc' |
|
180 | 180 | scanning source... |
|
181 | 181 | sorting... |
|
182 | 182 | converting... |
|
183 | 183 | 0 copy a file |
|
184 | 184 | $ svnupanddisplay a-hg-wc 1 |
|
185 | 185 | At revision 4. |
|
186 | 186 | 4 4 test . |
|
187 | 187 | 4 3 test b |
|
188 | 188 | 4 4 test c |
|
189 | 189 | 4 1 test d1 |
|
190 | 190 | 4 1 test d1/d2 |
|
191 | 191 | 4 1 test d1/d2/b |
|
192 | 192 | 4 3 test newlink |
|
193 | 193 | <?xml version="1.0"?> |
|
194 | 194 | <log> |
|
195 | 195 | <logentry |
|
196 | 196 | revision="4"> |
|
197 | 197 | <author>test</author> |
|
198 | 198 | <date/> |
|
199 | 199 | <paths> |
|
200 | 200 | <path |
|
201 | 201 | copyfrom-path="/b" |
|
202 | 202 | copyfrom-rev="3" |
|
203 | 203 | action="A">/c</path> |
|
204 | 204 | </paths> |
|
205 | 205 | <msg>copy a file</msg> |
|
206 | 206 | </logentry> |
|
207 | 207 | </log> |
|
208 | 208 | $ ls a a-hg-wc |
|
209 | 209 | a: |
|
210 | 210 | b |
|
211 | 211 | c |
|
212 | 212 | d1 |
|
213 | 213 | newlink |
|
214 | 214 | |
|
215 | 215 | a-hg-wc: |
|
216 | 216 | b |
|
217 | 217 | c |
|
218 | 218 | d1 |
|
219 | 219 | newlink |
|
220 | 220 | |
|
221 | 221 | $ hg --cwd a rm b |
|
222 | $ echo % remove | |
|
223 |
|
|
|
222 | ||
|
223 | Remove | |
|
224 | ||
|
224 | 225 | $ hg --cwd a ci -d '4 0' -m 'remove a file' |
|
225 | 226 | $ hg --cwd a tip -q |
|
226 | 227 | 4:07b2e34a5b17 |
|
227 | 228 | |
|
228 | 229 | $ hg convert -d svn a |
|
229 | 230 | assuming destination a-hg |
|
230 | 231 | initializing svn working copy 'a-hg-wc' |
|
231 | 232 | scanning source... |
|
232 | 233 | sorting... |
|
233 | 234 | converting... |
|
234 | 235 | 0 remove a file |
|
235 | 236 | $ svnupanddisplay a-hg-wc 1 |
|
236 | 237 | At revision 5. |
|
237 | 238 | 5 5 test . |
|
238 | 239 | 5 4 test c |
|
239 | 240 | 5 1 test d1 |
|
240 | 241 | 5 1 test d1/d2 |
|
241 | 242 | 5 1 test d1/d2/b |
|
242 | 243 | 5 3 test newlink |
|
243 | 244 | <?xml version="1.0"?> |
|
244 | 245 | <log> |
|
245 | 246 | <logentry |
|
246 | 247 | revision="5"> |
|
247 | 248 | <author>test</author> |
|
248 | 249 | <date/> |
|
249 | 250 | <paths> |
|
250 | 251 | <path |
|
251 | 252 | action="D">/b</path> |
|
252 | 253 | </paths> |
|
253 | 254 | <msg>remove a file</msg> |
|
254 | 255 | </logentry> |
|
255 | 256 | </log> |
|
256 | 257 | $ ls a a-hg-wc |
|
257 | 258 | a: |
|
258 | 259 | c |
|
259 | 260 | d1 |
|
260 | 261 | newlink |
|
261 | 262 | |
|
262 | 263 | a-hg-wc: |
|
263 | 264 | c |
|
264 | 265 | d1 |
|
265 | 266 | newlink |
|
266 | 267 | |
|
267 | 268 | Exectutable |
|
268 | 269 | |
|
269 | 270 | $ chmod +x a/c |
|
270 | 271 | $ hg --cwd a ci -d '5 0' -m 'make a file executable' |
|
271 | 272 | $ hg --cwd a tip -q |
|
272 | 273 | 5:31093672760b |
|
273 | 274 | |
|
274 | 275 | $ hg convert -d svn a |
|
275 | 276 | assuming destination a-hg |
|
276 | 277 | initializing svn working copy 'a-hg-wc' |
|
277 | 278 | scanning source... |
|
278 | 279 | sorting... |
|
279 | 280 | converting... |
|
280 | 281 | 0 make a file executable |
|
281 | 282 | $ svnupanddisplay a-hg-wc 1 |
|
282 | 283 | At revision 6. |
|
283 | 284 | 6 6 test . |
|
284 | 285 | 6 6 test c |
|
285 | 286 | 6 1 test d1 |
|
286 | 287 | 6 1 test d1/d2 |
|
287 | 288 | 6 1 test d1/d2/b |
|
288 | 289 | 6 3 test newlink |
|
289 | 290 | <?xml version="1.0"?> |
|
290 | 291 | <log> |
|
291 | 292 | <logentry |
|
292 | 293 | revision="6"> |
|
293 | 294 | <author>test</author> |
|
294 | 295 | <date/> |
|
295 | 296 | <paths> |
|
296 | 297 | <path |
|
297 | 298 | action="M">/c</path> |
|
298 | 299 | </paths> |
|
299 | 300 | <msg>make a file executable</msg> |
|
300 | 301 | </logentry> |
|
301 | 302 | </log> |
|
302 | 303 | $ test -x a-hg-wc/c |
|
303 | 304 | |
|
304 | 305 | Executable in new directory |
|
305 | 306 | |
|
306 | 307 | $ rm -rf a a-hg a-hg-wc |
|
307 | 308 | $ hg init a |
|
308 | 309 | |
|
309 | 310 | $ mkdir a/d1 |
|
310 | 311 | $ echo a > a/d1/a |
|
311 | 312 | $ chmod +x a/d1/a |
|
312 | 313 | $ hg --cwd a ci -d '0 0' -A -m 'add executable file in new directory' |
|
313 | 314 | adding d1/a |
|
314 | 315 | |
|
315 | 316 | $ hg convert -d svn a |
|
316 | 317 | assuming destination a-hg |
|
317 | 318 | initializing svn repository 'a-hg' |
|
318 | 319 | initializing svn working copy 'a-hg-wc' |
|
319 | 320 | scanning source... |
|
320 | 321 | sorting... |
|
321 | 322 | converting... |
|
322 | 323 | 0 add executable file in new directory |
|
323 | 324 | $ svnupanddisplay a-hg-wc 1 |
|
324 | 325 | At revision 1. |
|
325 | 326 | 1 1 test . |
|
326 | 327 | 1 1 test d1 |
|
327 | 328 | 1 1 test d1/a |
|
328 | 329 | <?xml version="1.0"?> |
|
329 | 330 | <log> |
|
330 | 331 | <logentry |
|
331 | 332 | revision="1"> |
|
332 | 333 | <author>test</author> |
|
333 | 334 | <date/> |
|
334 | 335 | <paths> |
|
335 | 336 | <path |
|
336 | 337 | action="A">/d1</path> |
|
337 | 338 | <path |
|
338 | 339 | action="A">/d1/a</path> |
|
339 | 340 | </paths> |
|
340 | 341 | <msg>add executable file in new directory</msg> |
|
341 | 342 | </logentry> |
|
342 | 343 | </log> |
|
343 | 344 | $ test -x a-hg-wc/d1/a |
|
344 | 345 | |
|
345 | 346 | Copy to new directory |
|
346 | 347 | |
|
347 | 348 | $ mkdir a/d2 |
|
348 | 349 | $ hg --cwd a cp d1/a d2/a |
|
349 | 350 | $ hg --cwd a ci -d '1 0' -A -m 'copy file to new directory' |
|
350 | 351 | |
|
351 | 352 | $ hg convert -d svn a |
|
352 | 353 | assuming destination a-hg |
|
353 | 354 | initializing svn working copy 'a-hg-wc' |
|
354 | 355 | scanning source... |
|
355 | 356 | sorting... |
|
356 | 357 | converting... |
|
357 | 358 | 0 copy file to new directory |
|
358 | 359 | $ svnupanddisplay a-hg-wc 1 |
|
359 | 360 | At revision 2. |
|
360 | 361 | 2 2 test . |
|
361 | 362 | 2 1 test d1 |
|
362 | 363 | 2 1 test d1/a |
|
363 | 364 | 2 2 test d2 |
|
364 | 365 | 2 2 test d2/a |
|
365 | 366 | <?xml version="1.0"?> |
|
366 | 367 | <log> |
|
367 | 368 | <logentry |
|
368 | 369 | revision="2"> |
|
369 | 370 | <author>test</author> |
|
370 | 371 | <date/> |
|
371 | 372 | <paths> |
|
372 | 373 | <path |
|
373 | 374 | action="A">/d2</path> |
|
374 | 375 | <path |
|
375 | 376 | copyfrom-path="/d1/a" |
|
376 | 377 | copyfrom-rev="1" |
|
377 | 378 | action="A">/d2/a</path> |
|
378 | 379 | </paths> |
|
379 | 380 | <msg>copy file to new directory</msg> |
|
380 | 381 | </logentry> |
|
381 | 382 | </log> |
|
382 | 383 | |
|
383 | 384 | Branchy history |
|
384 | 385 | |
|
385 | 386 | $ hg init b |
|
386 | 387 | $ echo base > b/b |
|
387 | 388 | $ hg --cwd b ci -d '0 0' -Ambase |
|
388 | 389 | adding b |
|
389 | 390 | |
|
390 | 391 | $ "$TESTDIR/svn-safe-append.py" left-1 b/b |
|
391 | 392 | $ echo left-1 > b/left-1 |
|
392 | 393 | $ hg --cwd b ci -d '1 0' -Amleft-1 |
|
393 | 394 | adding left-1 |
|
394 | 395 | |
|
395 | 396 | $ "$TESTDIR/svn-safe-append.py" left-2 b/b |
|
396 | 397 | $ echo left-2 > b/left-2 |
|
397 | 398 | $ hg --cwd b ci -d '2 0' -Amleft-2 |
|
398 | 399 | adding left-2 |
|
399 | 400 | |
|
400 | 401 | $ hg --cwd b up 0 |
|
401 | 402 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
402 | 403 | |
|
403 | 404 | $ "$TESTDIR/svn-safe-append.py" right-1 b/b |
|
404 | 405 | $ echo right-1 > b/right-1 |
|
405 | 406 | $ hg --cwd b ci -d '3 0' -Amright-1 |
|
406 | 407 | adding right-1 |
|
407 | 408 | created new head |
|
408 | 409 | |
|
409 | 410 | $ "$TESTDIR/svn-safe-append.py" right-2 b/b |
|
410 | 411 | $ echo right-2 > b/right-2 |
|
411 | 412 | $ hg --cwd b ci -d '4 0' -Amright-2 |
|
412 | 413 | adding right-2 |
|
413 | 414 | |
|
414 | 415 | $ hg --cwd b up -C 2 |
|
415 | 416 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
416 | 417 | $ hg --cwd b merge |
|
417 | 418 | merging b |
|
418 | 419 | warning: conflicts during merge. |
|
419 | 420 | merging b failed! |
|
420 | 421 | 2 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
421 | 422 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
422 | 423 | [1] |
|
423 | 424 | $ hg --cwd b revert -r 2 b |
|
424 | 425 | $ hg resolve -m b |
|
425 | 426 | $ hg --cwd b ci -d '5 0' -m 'merge' |
|
426 | 427 | |
|
427 | 428 | Expect 4 changes |
|
428 | 429 | |
|
429 | 430 | $ hg convert -d svn b |
|
430 | 431 | assuming destination b-hg |
|
431 | 432 | initializing svn repository 'b-hg' |
|
432 | 433 | initializing svn working copy 'b-hg-wc' |
|
433 | 434 | scanning source... |
|
434 | 435 | sorting... |
|
435 | 436 | converting... |
|
436 | 437 | 5 base |
|
437 | 438 | 4 left-1 |
|
438 | 439 | 3 left-2 |
|
439 | 440 | 2 right-1 |
|
440 | 441 | 1 right-2 |
|
441 | 442 | 0 merge |
|
442 | 443 | |
|
443 | 444 | $ svnupanddisplay b-hg-wc 0 |
|
444 | 445 | At revision 4. |
|
445 | 446 | 4 4 test . |
|
446 | 447 | 4 3 test b |
|
447 | 448 | 4 2 test left-1 |
|
448 | 449 | 4 3 test left-2 |
|
449 | 450 | 4 4 test right-1 |
|
450 | 451 | 4 4 test right-2 |
|
451 | 452 | <?xml version="1.0"?> |
|
452 | 453 | <log> |
|
453 | 454 | <logentry |
|
454 | 455 | revision="4"> |
|
455 | 456 | <author>test</author> |
|
456 | 457 | <date/> |
|
457 | 458 | <paths> |
|
458 | 459 | <path |
|
459 | 460 | action="A">/right-1</path> |
|
460 | 461 | <path |
|
461 | 462 | action="A">/right-2</path> |
|
462 | 463 | </paths> |
|
463 | 464 | <msg>merge</msg> |
|
464 | 465 | </logentry> |
|
465 | 466 | <logentry |
|
466 | 467 | revision="3"> |
|
467 | 468 | <author>test</author> |
|
468 | 469 | <date/> |
|
469 | 470 | <paths> |
|
470 | 471 | <path |
|
471 | 472 | action="M">/b</path> |
|
472 | 473 | <path |
|
473 | 474 | action="A">/left-2</path> |
|
474 | 475 | </paths> |
|
475 | 476 | <msg>left-2</msg> |
|
476 | 477 | </logentry> |
|
477 | 478 | <logentry |
|
478 | 479 | revision="2"> |
|
479 | 480 | <author>test</author> |
|
480 | 481 | <date/> |
|
481 | 482 | <paths> |
|
482 | 483 | <path |
|
483 | 484 | action="M">/b</path> |
|
484 | 485 | <path |
|
485 | 486 | action="A">/left-1</path> |
|
486 | 487 | </paths> |
|
487 | 488 | <msg>left-1</msg> |
|
488 | 489 | </logentry> |
|
489 | 490 | <logentry |
|
490 | 491 | revision="1"> |
|
491 | 492 | <author>test</author> |
|
492 | 493 | <date/> |
|
493 | 494 | <paths> |
|
494 | 495 | <path |
|
495 | 496 | action="A">/b</path> |
|
496 | 497 | </paths> |
|
497 | 498 | <msg>base</msg> |
|
498 | 499 | </logentry> |
|
499 | 500 | </log> |
|
500 | 501 | |
|
501 | 502 | Tags are not supported, but must not break conversion |
|
502 | 503 | |
|
503 | 504 | $ rm -rf a a-hg a-hg-wc |
|
504 | 505 | $ hg init a |
|
505 | 506 | $ echo a > a/a |
|
506 | 507 | $ hg --cwd a ci -d '0 0' -A -m 'Add file a' |
|
507 | 508 | adding a |
|
508 | 509 | $ hg --cwd a tag -d '1 0' -m 'Tagged as v1.0' v1.0 |
|
509 | 510 | |
|
510 | 511 | $ hg convert -d svn a |
|
511 | 512 | assuming destination a-hg |
|
512 | 513 | initializing svn repository 'a-hg' |
|
513 | 514 | initializing svn working copy 'a-hg-wc' |
|
514 | 515 | scanning source... |
|
515 | 516 | sorting... |
|
516 | 517 | converting... |
|
517 | 518 | 1 Add file a |
|
518 | 519 | 0 Tagged as v1.0 |
|
519 | 520 | writing Subversion tags is not yet implemented |
|
520 | 521 | $ svnupanddisplay a-hg-wc 2 |
|
521 | 522 | At revision 2. |
|
522 | 523 | 2 2 test . |
|
523 | 524 | 2 1 test a |
|
524 | 525 | 2 2 test .hgtags |
|
525 | 526 | <?xml version="1.0"?> |
|
526 | 527 | <log> |
|
527 | 528 | <logentry |
|
528 | 529 | revision="2"> |
|
529 | 530 | <author>test</author> |
|
530 | 531 | <date/> |
|
531 | 532 | <paths> |
|
532 | 533 | <path |
|
533 | 534 | action="A">/.hgtags</path> |
|
534 | 535 | </paths> |
|
535 | 536 | <msg>Tagged as v1.0</msg> |
|
536 | 537 | </logentry> |
|
537 | 538 | <logentry |
|
538 | 539 | revision="1"> |
|
539 | 540 | <author>test</author> |
|
540 | 541 | <date/> |
|
541 | 542 | <paths> |
|
542 | 543 | <path |
|
543 | 544 | action="A">/a</path> |
|
544 | 545 | </paths> |
|
545 | 546 | <msg>Add file a</msg> |
|
546 | 547 | </logentry> |
|
547 | 548 | </log> |
|
548 | 549 | $ rm -rf a a-hg a-hg-wc |
@@ -1,127 +1,124 b'' | |||
|
1 | 1 | Setup |
|
2 | 2 | |
|
3 | 3 | $ echo "[color]" >> $HGRCPATH |
|
4 | 4 | $ echo "mode = ansi" >> $HGRCPATH |
|
5 | 5 | $ echo "[extensions]" >> $HGRCPATH |
|
6 | 6 | $ echo "color=" >> $HGRCPATH |
|
7 | 7 | $ hg init repo |
|
8 | 8 | $ cd repo |
|
9 | 9 | $ cat > a <<EOF |
|
10 | 10 | > c |
|
11 | 11 | > c |
|
12 | 12 | > a |
|
13 | 13 | > a |
|
14 | 14 | > b |
|
15 | 15 | > a |
|
16 | 16 | > a |
|
17 | 17 | > c |
|
18 | 18 | > c |
|
19 | 19 | > EOF |
|
20 | 20 | $ hg ci -Am adda |
|
21 | 21 | adding a |
|
22 | 22 | $ cat > a <<EOF |
|
23 | 23 | > c |
|
24 | 24 | > c |
|
25 | 25 | > a |
|
26 | 26 | > a |
|
27 | 27 | > dd |
|
28 | 28 | > a |
|
29 | 29 | > a |
|
30 | 30 | > c |
|
31 | 31 | > c |
|
32 | 32 | > EOF |
|
33 | 33 | |
|
34 | 34 | default context |
|
35 | 35 | |
|
36 | 36 | $ hg diff --nodates --color=always |
|
37 | 37 | \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc) |
|
38 | 38 | \x1b[0;31;1m--- a/a\x1b[0m (esc) |
|
39 | 39 | \x1b[0;32;1m+++ b/a\x1b[0m (esc) |
|
40 | 40 | \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc) |
|
41 | 41 | c |
|
42 | 42 | a |
|
43 | 43 | a |
|
44 | 44 | \x1b[0;31m-b\x1b[0m (esc) |
|
45 | 45 | \x1b[0;32m+dd\x1b[0m (esc) |
|
46 | 46 | a |
|
47 | 47 | a |
|
48 | 48 | c |
|
49 | 49 | |
|
50 | 50 | --unified=2 |
|
51 | 51 | |
|
52 | 52 | $ hg diff --nodates -U 2 --color=always |
|
53 | 53 | \x1b[0;1mdiff -r cf9f4ba66af2 a\x1b[0m (esc) |
|
54 | 54 | \x1b[0;31;1m--- a/a\x1b[0m (esc) |
|
55 | 55 | \x1b[0;32;1m+++ b/a\x1b[0m (esc) |
|
56 | 56 | \x1b[0;35m@@ -3,5 +3,5 @@\x1b[0m (esc) |
|
57 | 57 | a |
|
58 | 58 | a |
|
59 | 59 | \x1b[0;31m-b\x1b[0m (esc) |
|
60 | 60 | \x1b[0;32m+dd\x1b[0m (esc) |
|
61 | 61 | a |
|
62 | 62 | a |
|
63 | 63 | |
|
64 | 64 | diffstat |
|
65 | 65 | |
|
66 | 66 | $ hg diff --stat --color=always |
|
67 | 67 | a | 2 \x1b[0;32m+\x1b[0m\x1b[0;31m-\x1b[0m (esc) |
|
68 | 68 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
69 | 69 | $ echo "record=" >> $HGRCPATH |
|
70 | 70 | $ echo "[ui]" >> $HGRCPATH |
|
71 | 71 | $ echo "interactive=true" >> $HGRCPATH |
|
72 | 72 | $ echo "[diff]" >> $HGRCPATH |
|
73 | 73 | $ echo "git=True" >> $HGRCPATH |
|
74 | 74 | |
|
75 | 75 | record |
|
76 | 76 | |
|
77 | 77 | $ chmod 0755 a |
|
78 | 78 | $ hg record --color=always -m moda a <<EOF |
|
79 | 79 | > y |
|
80 | 80 | > y |
|
81 | 81 | > EOF |
|
82 | 82 | \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc) |
|
83 | 83 | \x1b[0;36;1mold mode 100644\x1b[0m (esc) |
|
84 | 84 | \x1b[0;36;1mnew mode 100755\x1b[0m (esc) |
|
85 | 85 | 1 hunks, 1 lines changed |
|
86 | 86 | \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc) |
|
87 | 87 | \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc) |
|
88 | 88 | c |
|
89 | 89 | a |
|
90 | 90 | a |
|
91 | 91 | \x1b[0;31m-b\x1b[0m (esc) |
|
92 | 92 | \x1b[0;32m+dd\x1b[0m (esc) |
|
93 | 93 | a |
|
94 | 94 | a |
|
95 | 95 | c |
|
96 | 96 | \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc) |
|
97 | $ echo | |
|
98 | ||
|
97 | ||
|
99 | 98 | $ echo "[extensions]" >> $HGRCPATH |
|
100 | 99 | $ echo "mq=" >> $HGRCPATH |
|
101 | 100 | $ hg rollback |
|
102 | 101 | repository tip rolled back to revision 0 (undo commit) |
|
103 | 102 | working directory now based on revision 0 |
|
104 | 103 | |
|
105 | 104 | qrecord |
|
106 | 105 | |
|
107 | 106 | $ hg qrecord --color=always -m moda patch <<EOF |
|
108 | 107 | > y |
|
109 | 108 | > y |
|
110 | 109 | > EOF |
|
111 | 110 | \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc) |
|
112 | 111 | \x1b[0;36;1mold mode 100644\x1b[0m (esc) |
|
113 | 112 | \x1b[0;36;1mnew mode 100755\x1b[0m (esc) |
|
114 | 113 | 1 hunks, 1 lines changed |
|
115 | 114 | \x1b[0;33mexamine changes to 'a'? [Ynsfdaq?]\x1b[0m (esc) |
|
116 | 115 | \x1b[0;35m@@ -2,7 +2,7 @@\x1b[0m (esc) |
|
117 | 116 | c |
|
118 | 117 | a |
|
119 | 118 | a |
|
120 | 119 | \x1b[0;31m-b\x1b[0m (esc) |
|
121 | 120 | \x1b[0;32m+dd\x1b[0m (esc) |
|
122 | 121 | a |
|
123 | 122 | a |
|
124 | 123 | c |
|
125 | 124 | \x1b[0;33mrecord this change to 'a'? [Ynsfdaq?]\x1b[0m (esc) |
|
126 | $ echo | |
|
127 |
@@ -1,418 +1,410 b'' | |||
|
1 | 1 | adjust to non-default HGPORT, e.g. with run-tests.py -j |
|
2 | 2 | |
|
3 | 3 | $ echo "[extensions]" >> $HGRCPATH |
|
4 | 4 | $ echo "fetch=" >> $HGRCPATH |
|
5 | 5 | |
|
6 | 6 | test fetch with default branches only |
|
7 | 7 | |
|
8 | 8 | $ hg init a |
|
9 | 9 | $ echo a > a/a |
|
10 | 10 | $ hg --cwd a commit -d '1 0' -Ama |
|
11 | 11 | adding a |
|
12 | 12 | $ hg clone a b |
|
13 | 13 | updating to branch default |
|
14 | 14 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
15 | 15 | $ hg clone a c |
|
16 | 16 | updating to branch default |
|
17 | 17 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
18 | 18 | $ echo b > a/b |
|
19 | 19 | $ hg --cwd a commit -d '2 0' -Amb |
|
20 | 20 | adding b |
|
21 | 21 | $ hg --cwd a parents -q |
|
22 | 22 | 1:97d72e5f12c7 |
|
23 | 23 | |
|
24 | 24 | should pull one change |
|
25 | 25 | |
|
26 | 26 | $ hg --cwd b fetch ../a |
|
27 | 27 | pulling from ../a |
|
28 | 28 | searching for changes |
|
29 | 29 | adding changesets |
|
30 | 30 | adding manifests |
|
31 | 31 | adding file changes |
|
32 | 32 | added 1 changesets with 1 changes to 1 files |
|
33 | 33 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
34 | 34 | $ hg --cwd b parents -q |
|
35 | 35 | 1:97d72e5f12c7 |
|
36 | 36 | $ echo c > c/c |
|
37 | 37 | $ hg --cwd c commit -d '3 0' -Amc |
|
38 | 38 | adding c |
|
39 | 39 | $ hg clone c d |
|
40 | 40 | updating to branch default |
|
41 | 41 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
42 | 42 | $ hg clone c e |
|
43 | 43 | updating to branch default |
|
44 | 44 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
45 | 45 | |
|
46 | 46 | We cannot use the default commit message if fetching from a local |
|
47 | 47 | repo, because the path of the repo will be included in the commit |
|
48 | 48 | message, making every commit appear different. |
|
49 | 49 | should merge c into a |
|
50 | 50 | |
|
51 | 51 | $ hg --cwd c fetch -d '4 0' -m 'automated merge' ../a |
|
52 | 52 | pulling from ../a |
|
53 | 53 | searching for changes |
|
54 | 54 | adding changesets |
|
55 | 55 | adding manifests |
|
56 | 56 | adding file changes |
|
57 | 57 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
58 | 58 | updating to 2:97d72e5f12c7 |
|
59 | 59 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
60 | 60 | merging with 1:5e056962225c |
|
61 | 61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
62 | 62 | new changeset 3:cd3a41621cf0 merges remote changes with local |
|
63 | 63 | $ ls c |
|
64 | 64 | a |
|
65 | 65 | b |
|
66 | 66 | c |
|
67 | 67 | $ netstat -tnap 2>/dev/null | grep $HGPORT | grep LISTEN |
|
68 | 68 | [1] |
|
69 | 69 | $ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid |
|
70 | 70 | $ cat a/hg.pid >> "$DAEMON_PIDS" |
|
71 | 71 | |
|
72 | 72 | fetch over http, no auth |
|
73 | 73 | |
|
74 | 74 | $ hg --cwd d fetch -d '5 0' http://localhost:$HGPORT/ |
|
75 | 75 | pulling from http://localhost:$HGPORT/ |
|
76 | 76 | searching for changes |
|
77 | 77 | adding changesets |
|
78 | 78 | adding manifests |
|
79 | 79 | adding file changes |
|
80 | 80 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
81 | 81 | updating to 2:97d72e5f12c7 |
|
82 | 82 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
83 | 83 | merging with 1:5e056962225c |
|
84 | 84 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
85 | 85 | new changeset 3:* merges remote changes with local (glob) |
|
86 | 86 | $ hg --cwd d tip --template '{desc}\n' |
|
87 | 87 | Automated merge with http://localhost:$HGPORT/ |
|
88 | 88 | |
|
89 | 89 | fetch over http with auth (should be hidden in desc) |
|
90 | 90 | |
|
91 | 91 | $ hg --cwd e fetch -d '5 0' http://user:password@localhost:$HGPORT/ |
|
92 | 92 | pulling from http://user:***@localhost:$HGPORT/ |
|
93 | 93 | searching for changes |
|
94 | 94 | adding changesets |
|
95 | 95 | adding manifests |
|
96 | 96 | adding file changes |
|
97 | 97 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
98 | 98 | updating to 2:97d72e5f12c7 |
|
99 | 99 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
100 | 100 | merging with 1:5e056962225c |
|
101 | 101 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 102 | new changeset 3:* merges remote changes with local (glob) |
|
103 | 103 | $ hg --cwd e tip --template '{desc}\n' |
|
104 | 104 | Automated merge with http://localhost:$HGPORT/ |
|
105 | 105 | $ hg clone a f |
|
106 | 106 | updating to branch default |
|
107 | 107 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
108 | 108 | $ hg clone a g |
|
109 | 109 | updating to branch default |
|
110 | 110 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
111 | 111 | $ echo f > f/f |
|
112 | 112 | $ hg --cwd f ci -d '6 0' -Amf |
|
113 | 113 | adding f |
|
114 | 114 | $ echo g > g/g |
|
115 | 115 | $ hg --cwd g ci -d '6 0' -Amg |
|
116 | 116 | adding g |
|
117 | 117 | $ hg clone -q f h |
|
118 | 118 | $ hg clone -q g i |
|
119 | 119 | |
|
120 | 120 | should merge f into g |
|
121 | 121 | |
|
122 | 122 | $ hg --cwd g fetch -d '7 0' --switch -m 'automated merge' ../f |
|
123 | 123 | pulling from ../f |
|
124 | 124 | searching for changes |
|
125 | 125 | adding changesets |
|
126 | 126 | adding manifests |
|
127 | 127 | adding file changes |
|
128 | 128 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
129 | 129 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
130 | 130 | merging with 3:cc6a3744834d |
|
131 | 131 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
132 | 132 | new changeset 4:55aa4f32ec59 merges remote changes with local |
|
133 | 133 | $ rm i/g |
|
134 | 134 | |
|
135 | 135 | should abort, because i is modified |
|
136 | 136 | |
|
137 | 137 | $ hg --cwd i fetch ../h |
|
138 | 138 | abort: working directory is missing some files |
|
139 | 139 | [255] |
|
140 | 140 | |
|
141 | 141 | test fetch with named branches |
|
142 | 142 | |
|
143 | 143 | $ hg init nbase |
|
144 | 144 | $ echo base > nbase/a |
|
145 | 145 | $ hg -R nbase ci -d '1 0' -Am base |
|
146 | 146 | adding a |
|
147 | 147 | $ hg -R nbase branch a |
|
148 | 148 | marked working directory as branch a |
|
149 | 149 | $ echo a > nbase/a |
|
150 | 150 | $ hg -R nbase ci -d '2 0' -m a |
|
151 | 151 | $ hg -R nbase up -C 0 |
|
152 | 152 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
153 | 153 | $ hg -R nbase branch b |
|
154 | 154 | marked working directory as branch b |
|
155 | 155 | $ echo b > nbase/b |
|
156 | 156 | $ hg -R nbase ci -Ad '3 0' -m b |
|
157 | 157 | adding b |
|
158 | $ echo | |
|
159 | ||
|
160 | 158 | |
|
161 | 159 | pull in change on foreign branch |
|
162 | 160 | |
|
163 | 161 | $ hg clone nbase n1 |
|
164 | 162 | updating to branch default |
|
165 | 163 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
166 | 164 | $ hg clone nbase n2 |
|
167 | 165 | updating to branch default |
|
168 | 166 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
169 | 167 | $ hg -R n1 up -C a |
|
170 | 168 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
171 | 169 | $ echo aa > n1/a |
|
172 | 170 | $ hg -R n1 ci -d '4 0' -m a1 |
|
173 | 171 | $ hg -R n2 up -C b |
|
174 | 172 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
175 | 173 | $ hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
176 | 174 | pulling from n1 |
|
177 | 175 | searching for changes |
|
178 | 176 | adding changesets |
|
179 | 177 | adding manifests |
|
180 | 178 | adding file changes |
|
181 | 179 | added 1 changesets with 1 changes to 1 files |
|
182 | 180 | |
|
183 | 181 | parent should be 2 (no automatic update) |
|
184 | 182 | |
|
185 | 183 | $ hg -R n2 parents --template '{rev}\n' |
|
186 | 184 | 2 |
|
187 | 185 | $ rm -fr n1 n2 |
|
188 | $ echo | |
|
189 | ||
|
190 | 186 | |
|
191 | 187 | pull in changes on both foreign and local branches |
|
192 | 188 | |
|
193 | 189 | $ hg clone nbase n1 |
|
194 | 190 | updating to branch default |
|
195 | 191 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
196 | 192 | $ hg clone nbase n2 |
|
197 | 193 | updating to branch default |
|
198 | 194 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
199 | 195 | $ hg -R n1 up -C a |
|
200 | 196 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
201 | 197 | $ echo aa > n1/a |
|
202 | 198 | $ hg -R n1 ci -d '4 0' -m a1 |
|
203 | 199 | $ hg -R n1 up -C b |
|
204 | 200 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
205 | 201 | $ echo bb > n1/b |
|
206 | 202 | $ hg -R n1 ci -d '5 0' -m b1 |
|
207 | 203 | $ hg -R n2 up -C b |
|
208 | 204 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
209 | 205 | $ hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
210 | 206 | pulling from n1 |
|
211 | 207 | searching for changes |
|
212 | 208 | adding changesets |
|
213 | 209 | adding manifests |
|
214 | 210 | adding file changes |
|
215 | 211 | added 2 changesets with 2 changes to 2 files |
|
216 | 212 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
217 | 213 | |
|
218 | 214 | parent should be 4 (fast forward) |
|
219 | 215 | |
|
220 | 216 | $ hg -R n2 parents --template '{rev}\n' |
|
221 | 217 | 4 |
|
222 | 218 | $ rm -fr n1 n2 |
|
223 | $ echo | |
|
224 | ||
|
225 | 219 | |
|
226 | 220 | pull changes on foreign (2 new heads) and local (1 new head) branches |
|
227 | 221 | with a local change |
|
228 | 222 | |
|
229 | 223 | $ hg clone nbase n1 |
|
230 | 224 | updating to branch default |
|
231 | 225 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
232 | 226 | $ hg clone nbase n2 |
|
233 | 227 | updating to branch default |
|
234 | 228 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
235 | 229 | $ hg -R n1 up -C a |
|
236 | 230 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
237 | 231 | $ echo a1 > n1/a |
|
238 | 232 | $ hg -R n1 ci -d '4 0' -m a1 |
|
239 | 233 | $ hg -R n1 up -C b |
|
240 | 234 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
241 | 235 | $ echo bb > n1/b |
|
242 | 236 | $ hg -R n1 ci -d '5 0' -m b1 |
|
243 | 237 | $ hg -R n1 up -C 1 |
|
244 | 238 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
245 | 239 | $ echo a2 > n1/a |
|
246 | 240 | $ hg -R n1 ci -d '6 0' -m a2 |
|
247 | 241 | created new head |
|
248 | 242 | $ hg -R n2 up -C b |
|
249 | 243 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
250 | 244 | $ echo change >> n2/c |
|
251 | 245 | $ hg -R n2 ci -Ad '7 0' -m local |
|
252 | 246 | adding c |
|
253 | 247 | $ hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
254 | 248 | pulling from n1 |
|
255 | 249 | searching for changes |
|
256 | 250 | adding changesets |
|
257 | 251 | adding manifests |
|
258 | 252 | adding file changes |
|
259 | 253 | added 3 changesets with 3 changes to 2 files (+2 heads) |
|
260 | 254 | updating to 5:708c6cce3d26 |
|
261 | 255 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
262 | 256 | merging with 3:d83427717b1f |
|
263 | 257 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
264 | 258 | new changeset 7:48f1a33f52af merges remote changes with local |
|
265 | 259 | |
|
266 | 260 | parent should be 7 (new merge changeset) |
|
267 | 261 | |
|
268 | 262 | $ hg -R n2 parents --template '{rev}\n' |
|
269 | 263 | 7 |
|
270 | 264 | $ rm -fr n1 n2 |
|
271 | 265 | |
|
272 | 266 | pull in changes on foreign (merge of local branch) and local (2 new |
|
273 | 267 | heads) with a local change |
|
274 | 268 | |
|
275 | 269 | $ hg clone nbase n1 |
|
276 | 270 | updating to branch default |
|
277 | 271 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
278 | 272 | $ hg clone nbase n2 |
|
279 | 273 | updating to branch default |
|
280 | 274 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
281 | 275 | $ hg -R n1 up -C a |
|
282 | 276 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
283 | 277 | $ hg -R n1 merge b |
|
284 | 278 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
285 | 279 | (branch merge, don't forget to commit) |
|
286 | 280 | $ hg -R n1 ci -d '4 0' -m merge |
|
287 | 281 | $ hg -R n1 up -C 2 |
|
288 | 282 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
289 | 283 | $ echo c > n1/a |
|
290 | 284 | $ hg -R n1 ci -d '5 0' -m c |
|
291 | 285 | $ hg -R n1 up -C 2 |
|
292 | 286 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
293 | 287 | $ echo cc > n1/a |
|
294 | 288 | $ hg -R n1 ci -d '6 0' -m cc |
|
295 | 289 | created new head |
|
296 | 290 | $ hg -R n2 up -C b |
|
297 | 291 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
298 | 292 | $ echo change >> n2/b |
|
299 | 293 | $ hg -R n2 ci -Ad '7 0' -m local |
|
300 | 294 | $ hg -R n2 fetch -d '9 0' -m 'merge' n1 |
|
301 | 295 | pulling from n1 |
|
302 | 296 | searching for changes |
|
303 | 297 | adding changesets |
|
304 | 298 | adding manifests |
|
305 | 299 | adding file changes |
|
306 | 300 | added 3 changesets with 2 changes to 1 files (+2 heads) |
|
307 | 301 | not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them) |
|
308 | 302 | [1] |
|
309 | 303 | |
|
310 | 304 | parent should be 3 (fetch did not merge anything) |
|
311 | 305 | |
|
312 | 306 | $ hg -R n2 parents --template '{rev}\n' |
|
313 | 307 | 3 |
|
314 | 308 | $ rm -fr n1 n2 |
|
315 | 309 | |
|
316 | 310 | pull in change on different branch than dirstate |
|
317 | 311 | |
|
318 | 312 | $ hg init n1 |
|
319 | 313 | $ echo a > n1/a |
|
320 | 314 | $ hg -R n1 ci -Am initial |
|
321 | 315 | adding a |
|
322 | 316 | $ hg clone n1 n2 |
|
323 | 317 | updating to branch default |
|
324 | 318 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
325 | 319 | $ echo b > n1/a |
|
326 | 320 | $ hg -R n1 ci -m next |
|
327 | 321 | $ hg -R n2 branch topic |
|
328 | 322 | marked working directory as branch topic |
|
329 | 323 | $ hg -R n2 fetch -d '0 0' -m merge n1 |
|
330 | 324 | abort: working dir not at branch tip (use "hg update" to check out branch tip) |
|
331 | 325 | [255] |
|
332 | 326 | |
|
333 | 327 | parent should be 0 (fetch did not update or merge anything) |
|
334 | 328 | |
|
335 | 329 | $ hg -R n2 parents --template '{rev}\n' |
|
336 | 330 | 0 |
|
337 | 331 | $ rm -fr n1 n2 |
|
338 | 332 | |
|
339 | 333 | test fetch with inactive branches |
|
340 | 334 | |
|
341 | 335 | $ hg init ib1 |
|
342 | 336 | $ echo a > ib1/a |
|
343 | 337 | $ hg --cwd ib1 ci -Am base |
|
344 | 338 | adding a |
|
345 | 339 | $ hg --cwd ib1 branch second |
|
346 | 340 | marked working directory as branch second |
|
347 | 341 | $ echo b > ib1/b |
|
348 | 342 | $ hg --cwd ib1 ci -Am onsecond |
|
349 | 343 | adding b |
|
350 | 344 | $ hg --cwd ib1 branch -f default |
|
351 | 345 | marked working directory as branch default |
|
352 | 346 | $ echo c > ib1/c |
|
353 | 347 | $ hg --cwd ib1 ci -Am newdefault |
|
354 | 348 | adding c |
|
355 | 349 | created new head |
|
356 | 350 | $ hg clone ib1 ib2 |
|
357 | 351 | updating to branch default |
|
358 | 352 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
359 | 353 | |
|
360 | 354 | fetch should succeed |
|
361 | 355 | |
|
362 | 356 | $ hg --cwd ib2 fetch ../ib1 |
|
363 | 357 | pulling from ../ib1 |
|
364 | 358 | searching for changes |
|
365 | 359 | no changes found |
|
366 | 360 | $ rm -fr ib1 ib2 |
|
367 | 361 | |
|
368 | 362 | test issue1726 |
|
369 | 363 | |
|
370 | 364 | $ hg init i1726r1 |
|
371 | 365 | $ echo a > i1726r1/a |
|
372 | 366 | $ hg --cwd i1726r1 ci -Am base |
|
373 | 367 | adding a |
|
374 | 368 | $ hg clone i1726r1 i1726r2 |
|
375 | 369 | updating to branch default |
|
376 | 370 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
377 | 371 | $ echo b > i1726r1/a |
|
378 | 372 | $ hg --cwd i1726r1 ci -m second |
|
379 | 373 | $ echo c > i1726r2/a |
|
380 | 374 | $ hg --cwd i1726r2 ci -m third |
|
381 | 375 | $ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 |
|
382 | 376 | pulling from ../i1726r1 |
|
383 | 377 | searching for changes |
|
384 | 378 | adding changesets |
|
385 | 379 | adding manifests |
|
386 | 380 | adding file changes |
|
387 | 381 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
388 | 382 | updating to 2:7837755a2789 |
|
389 | 383 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
390 | 384 | merging with 1:d1f0c6c48ebd |
|
391 | 385 | merging a |
|
392 | 386 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
393 | 387 | new changeset 3:* merges remote changes with local (glob) |
|
394 | 388 | $ hg --cwd i1726r2 heads default --template '{rev}\n' |
|
395 | 389 | 3 |
|
396 | $ echo | |
|
397 | ||
|
398 | 390 | |
|
399 | 391 | test issue2047 |
|
400 | 392 | |
|
401 | 393 | $ hg -q init i2047a |
|
402 | 394 | $ cd i2047a |
|
403 | 395 | $ echo a > a |
|
404 | 396 | $ hg -q ci -Am a |
|
405 | 397 | $ hg -q branch stable |
|
406 | 398 | $ echo b > b |
|
407 | 399 | $ hg -q ci -Am b |
|
408 | 400 | $ cd .. |
|
409 | 401 | $ hg -q clone -r 0 i2047a i2047b |
|
410 | 402 | $ cd i2047b |
|
411 | 403 | $ hg fetch ../i2047a |
|
412 | 404 | pulling from ../i2047a |
|
413 | 405 | searching for changes |
|
414 | 406 | adding changesets |
|
415 | 407 | adding manifests |
|
416 | 408 | adding file changes |
|
417 | 409 | added 1 changesets with 1 changes to 1 files |
|
418 | 410 | $ "$TESTDIR/killdaemons.py" |
@@ -1,609 +1,605 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ "$TESTDIR/hghave" pygments || exit 80 |
|
3 | 3 | $ cat <<EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > highlight = |
|
6 | 6 | > [web] |
|
7 | 7 | > pygments_style = friendly |
|
8 | 8 | > EOF |
|
9 | 9 | $ hg init test |
|
10 | 10 | $ cd test |
|
11 | 11 | |
|
12 | 12 | create random Python file to exercise Pygments |
|
13 | 13 | |
|
14 | 14 | $ cat <<EOF > primes.py |
|
15 | 15 | > #!/usr/bin/env python |
|
16 | 16 | > |
|
17 | 17 | > """Fun with generators. Corresponding Haskell implementation: |
|
18 | 18 | > |
|
19 | 19 | > primes = 2 : sieve [3, 5..] |
|
20 | 20 | > where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0] |
|
21 | 21 | > """ |
|
22 | 22 | > |
|
23 | 23 | > from itertools import dropwhile, ifilter, islice, count, chain |
|
24 | 24 | > |
|
25 | 25 | > def primes(): |
|
26 | 26 | > """Generate all primes.""" |
|
27 | 27 | > def sieve(ns): |
|
28 | 28 | > p = ns.next() |
|
29 | 29 | > # It is important to yield *here* in order to stop the |
|
30 | 30 | > # infinite recursion. |
|
31 | 31 | > yield p |
|
32 | 32 | > ns = ifilter(lambda n: n % p != 0, ns) |
|
33 | 33 | > for n in sieve(ns): |
|
34 | 34 | > yield n |
|
35 | 35 | > |
|
36 | 36 | > odds = ifilter(lambda i: i % 2 == 1, count()) |
|
37 | 37 | > return chain([2], sieve(dropwhile(lambda n: n < 3, odds))) |
|
38 | 38 | > |
|
39 | 39 | > if __name__ == "__main__": |
|
40 | 40 | > import sys |
|
41 | 41 | > try: |
|
42 | 42 | > n = int(sys.argv[1]) |
|
43 | 43 | > except (ValueError, IndexError): |
|
44 | 44 | > n = 10 |
|
45 | 45 | > p = primes() |
|
46 | 46 | > print "The first %d primes: %s" % (n, list(islice(p, n))) |
|
47 | 47 | > EOF |
|
48 | 48 | $ hg ci -Ama |
|
49 | 49 | adding primes.py |
|
50 | 50 | |
|
51 | 51 | hg serve |
|
52 | 52 | |
|
53 | 53 | $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log |
|
54 | 54 | $ cat hg.pid >> $DAEMON_PIDS |
|
55 | 55 | |
|
56 | 56 | hgweb filerevision, html |
|
57 | 57 | |
|
58 | 58 | $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py') \ |
|
59 | 59 | > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mf\"/class=\"mi\"/g" |
|
60 | 60 | 200 Script output follows |
|
61 | 61 | |
|
62 | 62 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
63 | 63 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
64 | 64 | <head> |
|
65 | 65 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
66 | 66 | <meta name="robots" content="index, nofollow" /> |
|
67 | 67 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
68 | 68 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
69 | 69 | |
|
70 | 70 | <link rel="stylesheet" href="/highlightcss" type="text/css" /> |
|
71 | 71 | <title>test: 853dcd4de2a6 primes.py</title> |
|
72 | 72 | </head> |
|
73 | 73 | <body> |
|
74 | 74 | |
|
75 | 75 | <div class="container"> |
|
76 | 76 | <div class="menu"> |
|
77 | 77 | <div class="logo"> |
|
78 | 78 | <a href="http://mercurial.selenic.com/"> |
|
79 | 79 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
80 | 80 | </div> |
|
81 | 81 | <ul> |
|
82 | 82 | <li><a href="/shortlog/853dcd4de2a6">log</a></li> |
|
83 | 83 | <li><a href="/graph/853dcd4de2a6">graph</a></li> |
|
84 | 84 | <li><a href="/tags">tags</a></li> |
|
85 | 85 | <li><a href="/branches">branches</a></li> |
|
86 | 86 | </ul> |
|
87 | 87 | <ul> |
|
88 | 88 | <li><a href="/rev/853dcd4de2a6">changeset</a></li> |
|
89 | 89 | <li><a href="/file/853dcd4de2a6/">browse</a></li> |
|
90 | 90 | </ul> |
|
91 | 91 | <ul> |
|
92 | 92 | <li class="active">file</li> |
|
93 | 93 | <li><a href="/file/tip/primes.py">latest</a></li> |
|
94 | 94 | <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li> |
|
95 | 95 | <li><a href="/annotate/853dcd4de2a6/primes.py">annotate</a></li> |
|
96 | 96 | <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li> |
|
97 | 97 | <li><a href="/raw-file/853dcd4de2a6/primes.py">raw</a></li> |
|
98 | 98 | </ul> |
|
99 | 99 | <ul> |
|
100 | 100 | <li><a href="/help">help</a></li> |
|
101 | 101 | </ul> |
|
102 | 102 | </div> |
|
103 | 103 | |
|
104 | 104 | <div class="main"> |
|
105 | 105 | <h2><a href="/">test</a></h2> |
|
106 | 106 | <h3>view primes.py @ 0:853dcd4de2a6</h3> |
|
107 | 107 | |
|
108 | 108 | <form class="search" action="/log"> |
|
109 | 109 | |
|
110 | 110 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
111 | 111 | <div id="hint">find changesets by author, revision, |
|
112 | 112 | files, or words in the commit message</div> |
|
113 | 113 | </form> |
|
114 | 114 | |
|
115 | 115 | <div class="description">a</div> |
|
116 | 116 | |
|
117 | 117 | <table id="changesetEntry"> |
|
118 | 118 | <tr> |
|
119 | 119 | <th class="author">author</th> |
|
120 | 120 | <td class="author">test</td> |
|
121 | 121 | </tr> |
|
122 | 122 | <tr> |
|
123 | 123 | <th class="date">date</th> |
|
124 | 124 | <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td> |
|
125 | 125 | </tr> |
|
126 | 126 | <tr> |
|
127 | 127 | <th class="author">parents</th> |
|
128 | 128 | <td class="author"></td> |
|
129 | 129 | </tr> |
|
130 | 130 | <tr> |
|
131 | 131 | <th class="author">children</th> |
|
132 | 132 | <td class="author"></td> |
|
133 | 133 | </tr> |
|
134 | 134 | |
|
135 | 135 | </table> |
|
136 | 136 | |
|
137 | 137 | <div class="overflow"> |
|
138 | 138 | <div class="sourcefirst"> line source</div> |
|
139 | 139 | |
|
140 | 140 | <div class="parity0 source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></div> |
|
141 | 141 | <div class="parity1 source"><a href="#l2" id="l2"> 2</a> </div> |
|
142 | 142 | <div class="parity0 source"><a href="#l3" id="l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></div> |
|
143 | 143 | <div class="parity1 source"><a href="#l4" id="l4"> 4</a> </div> |
|
144 | 144 | <div class="parity0 source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></div> |
|
145 | 145 | <div class="parity1 source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></div> |
|
146 | 146 | <div class="parity0 source"><a href="#l7" id="l7"> 7</a> <span class="sd">"""</span></div> |
|
147 | 147 | <div class="parity1 source"><a href="#l8" id="l8"> 8</a> </div> |
|
148 | 148 | <div class="parity0 source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></div> |
|
149 | 149 | <div class="parity1 source"><a href="#l10" id="l10"> 10</a> </div> |
|
150 | 150 | <div class="parity0 source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></div> |
|
151 | 151 | <div class="parity1 source"><a href="#l12" id="l12"> 12</a> <span class="sd">"""Generate all primes."""</span></div> |
|
152 | 152 | <div class="parity0 source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div> |
|
153 | 153 | <div class="parity1 source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></div> |
|
154 | 154 | <div class="parity0 source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></div> |
|
155 | 155 | <div class="parity1 source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></div> |
|
156 | 156 | <div class="parity0 source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></div> |
|
157 | 157 | <div class="parity1 source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></div> |
|
158 | 158 | <div class="parity0 source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></div> |
|
159 | 159 | <div class="parity1 source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></div> |
|
160 | 160 | <div class="parity0 source"><a href="#l21" id="l21"> 21</a> </div> |
|
161 | 161 | <div class="parity1 source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></div> |
|
162 | 162 | <div class="parity0 source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></div> |
|
163 | 163 | <div class="parity1 source"><a href="#l24" id="l24"> 24</a> </div> |
|
164 | 164 | <div class="parity0 source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></div> |
|
165 | 165 | <div class="parity1 source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></div> |
|
166 | 166 | <div class="parity0 source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></div> |
|
167 | 167 | <div class="parity1 source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></div> |
|
168 | 168 | <div class="parity0 source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></div> |
|
169 | 169 | <div class="parity1 source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></div> |
|
170 | 170 | <div class="parity0 source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></div> |
|
171 | 171 | <div class="parity1 source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></div> |
|
172 | 172 | <div class="sourcelast"></div> |
|
173 | 173 | </div> |
|
174 | 174 | </div> |
|
175 | 175 | </div> |
|
176 | 176 | |
|
177 | 177 | <script type="text/javascript">process_dates()</script> |
|
178 | 178 | |
|
179 | 179 | |
|
180 | 180 | </body> |
|
181 | 181 | </html> |
|
182 | 182 | |
|
183 | 183 | |
|
184 | 184 | hgweb fileannotate, html |
|
185 | 185 | |
|
186 | 186 | $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py') \ |
|
187 | 187 | > | sed "s/class=\"k\"/class=\"kn\"/g" | sed "s/class=\"mi\"/class=\"mf\"/g" |
|
188 | 188 | 200 Script output follows |
|
189 | 189 | |
|
190 | 190 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
191 | 191 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
192 | 192 | <head> |
|
193 | 193 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
194 | 194 | <meta name="robots" content="index, nofollow" /> |
|
195 | 195 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
196 | 196 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
197 | 197 | |
|
198 | 198 | <link rel="stylesheet" href="/highlightcss" type="text/css" /> |
|
199 | 199 | <title>test: primes.py annotate</title> |
|
200 | 200 | </head> |
|
201 | 201 | <body> |
|
202 | 202 | |
|
203 | 203 | <div class="container"> |
|
204 | 204 | <div class="menu"> |
|
205 | 205 | <div class="logo"> |
|
206 | 206 | <a href="http://mercurial.selenic.com/"> |
|
207 | 207 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
208 | 208 | </div> |
|
209 | 209 | <ul> |
|
210 | 210 | <li><a href="/shortlog/853dcd4de2a6">log</a></li> |
|
211 | 211 | <li><a href="/graph/853dcd4de2a6">graph</a></li> |
|
212 | 212 | <li><a href="/tags">tags</a></li> |
|
213 | 213 | <li><a href="/bookmarks">bookmarks</a></li> |
|
214 | 214 | <li><a href="/branches">branches</a></li> |
|
215 | 215 | </ul> |
|
216 | 216 | |
|
217 | 217 | <ul> |
|
218 | 218 | <li><a href="/rev/853dcd4de2a6">changeset</a></li> |
|
219 | 219 | <li><a href="/file/853dcd4de2a6/">browse</a></li> |
|
220 | 220 | </ul> |
|
221 | 221 | <ul> |
|
222 | 222 | <li><a href="/file/853dcd4de2a6/primes.py">file</a></li> |
|
223 | 223 | <li><a href="/file/tip/primes.py">latest</a></li> |
|
224 | 224 | <li><a href="/diff/853dcd4de2a6/primes.py">diff</a></li> |
|
225 | 225 | <li class="active">annotate</li> |
|
226 | 226 | <li><a href="/log/853dcd4de2a6/primes.py">file log</a></li> |
|
227 | 227 | <li><a href="/raw-annotate/853dcd4de2a6/primes.py">raw</a></li> |
|
228 | 228 | </ul> |
|
229 | 229 | <ul> |
|
230 | 230 | <li><a href="/help">help</a></li> |
|
231 | 231 | </ul> |
|
232 | 232 | </div> |
|
233 | 233 | |
|
234 | 234 | <div class="main"> |
|
235 | 235 | <h2><a href="/">test</a></h2> |
|
236 | 236 | <h3>annotate primes.py @ 0:853dcd4de2a6</h3> |
|
237 | 237 | |
|
238 | 238 | <form class="search" action="/log"> |
|
239 | 239 | |
|
240 | 240 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
241 | 241 | <div id="hint">find changesets by author, revision, |
|
242 | 242 | files, or words in the commit message</div> |
|
243 | 243 | </form> |
|
244 | 244 | |
|
245 | 245 | <div class="description">a</div> |
|
246 | 246 | |
|
247 | 247 | <table id="changesetEntry"> |
|
248 | 248 | <tr> |
|
249 | 249 | <th class="author">author</th> |
|
250 | 250 | <td class="author">test</td> |
|
251 | 251 | </tr> |
|
252 | 252 | <tr> |
|
253 | 253 | <th class="date">date</th> |
|
254 | 254 | <td class="date age">Thu Jan 01 00:00:00 1970 +0000</td> |
|
255 | 255 | </tr> |
|
256 | 256 | <tr> |
|
257 | 257 | <th class="author">parents</th> |
|
258 | 258 | <td class="author"></td> |
|
259 | 259 | </tr> |
|
260 | 260 | <tr> |
|
261 | 261 | <th class="author">children</th> |
|
262 | 262 | <td class="author"></td> |
|
263 | 263 | </tr> |
|
264 | 264 | |
|
265 | 265 | </table> |
|
266 | 266 | |
|
267 | 267 | <div class="overflow"> |
|
268 | 268 | <table class="bigtable"> |
|
269 | 269 | <tr> |
|
270 | 270 | <th class="annotate">rev</th> |
|
271 | 271 | <th class="line"> line source</th> |
|
272 | 272 | </tr> |
|
273 | 273 | |
|
274 | 274 | <tr class="parity0"> |
|
275 | 275 | <td class="annotate"> |
|
276 | 276 | <a href="/annotate/853dcd4de2a6/primes.py#1" |
|
277 | 277 | title="853dcd4de2a6: a">test@0</a> |
|
278 | 278 | </td> |
|
279 | 279 | <td class="source"><a href="#l1" id="l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td> |
|
280 | 280 | </tr> |
|
281 | 281 | <tr class="parity1"> |
|
282 | 282 | <td class="annotate"> |
|
283 | 283 | <a href="/annotate/853dcd4de2a6/primes.py#2" |
|
284 | 284 | title="853dcd4de2a6: a">test@0</a> |
|
285 | 285 | </td> |
|
286 | 286 | <td class="source"><a href="#l2" id="l2"> 2</a> </td> |
|
287 | 287 | </tr> |
|
288 | 288 | <tr class="parity0"> |
|
289 | 289 | <td class="annotate"> |
|
290 | 290 | <a href="/annotate/853dcd4de2a6/primes.py#3" |
|
291 | 291 | title="853dcd4de2a6: a">test@0</a> |
|
292 | 292 | </td> |
|
293 | 293 | <td class="source"><a href="#l3" id="l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td> |
|
294 | 294 | </tr> |
|
295 | 295 | <tr class="parity1"> |
|
296 | 296 | <td class="annotate"> |
|
297 | 297 | <a href="/annotate/853dcd4de2a6/primes.py#4" |
|
298 | 298 | title="853dcd4de2a6: a">test@0</a> |
|
299 | 299 | </td> |
|
300 | 300 | <td class="source"><a href="#l4" id="l4"> 4</a> </td> |
|
301 | 301 | </tr> |
|
302 | 302 | <tr class="parity0"> |
|
303 | 303 | <td class="annotate"> |
|
304 | 304 | <a href="/annotate/853dcd4de2a6/primes.py#5" |
|
305 | 305 | title="853dcd4de2a6: a">test@0</a> |
|
306 | 306 | </td> |
|
307 | 307 | <td class="source"><a href="#l5" id="l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td> |
|
308 | 308 | </tr> |
|
309 | 309 | <tr class="parity1"> |
|
310 | 310 | <td class="annotate"> |
|
311 | 311 | <a href="/annotate/853dcd4de2a6/primes.py#6" |
|
312 | 312 | title="853dcd4de2a6: a">test@0</a> |
|
313 | 313 | </td> |
|
314 | 314 | <td class="source"><a href="#l6" id="l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td> |
|
315 | 315 | </tr> |
|
316 | 316 | <tr class="parity0"> |
|
317 | 317 | <td class="annotate"> |
|
318 | 318 | <a href="/annotate/853dcd4de2a6/primes.py#7" |
|
319 | 319 | title="853dcd4de2a6: a">test@0</a> |
|
320 | 320 | </td> |
|
321 | 321 | <td class="source"><a href="#l7" id="l7"> 7</a> <span class="sd">"""</span></td> |
|
322 | 322 | </tr> |
|
323 | 323 | <tr class="parity1"> |
|
324 | 324 | <td class="annotate"> |
|
325 | 325 | <a href="/annotate/853dcd4de2a6/primes.py#8" |
|
326 | 326 | title="853dcd4de2a6: a">test@0</a> |
|
327 | 327 | </td> |
|
328 | 328 | <td class="source"><a href="#l8" id="l8"> 8</a> </td> |
|
329 | 329 | </tr> |
|
330 | 330 | <tr class="parity0"> |
|
331 | 331 | <td class="annotate"> |
|
332 | 332 | <a href="/annotate/853dcd4de2a6/primes.py#9" |
|
333 | 333 | title="853dcd4de2a6: a">test@0</a> |
|
334 | 334 | </td> |
|
335 | 335 | <td class="source"><a href="#l9" id="l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td> |
|
336 | 336 | </tr> |
|
337 | 337 | <tr class="parity1"> |
|
338 | 338 | <td class="annotate"> |
|
339 | 339 | <a href="/annotate/853dcd4de2a6/primes.py#10" |
|
340 | 340 | title="853dcd4de2a6: a">test@0</a> |
|
341 | 341 | </td> |
|
342 | 342 | <td class="source"><a href="#l10" id="l10"> 10</a> </td> |
|
343 | 343 | </tr> |
|
344 | 344 | <tr class="parity0"> |
|
345 | 345 | <td class="annotate"> |
|
346 | 346 | <a href="/annotate/853dcd4de2a6/primes.py#11" |
|
347 | 347 | title="853dcd4de2a6: a">test@0</a> |
|
348 | 348 | </td> |
|
349 | 349 | <td class="source"><a href="#l11" id="l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> |
|
350 | 350 | </tr> |
|
351 | 351 | <tr class="parity1"> |
|
352 | 352 | <td class="annotate"> |
|
353 | 353 | <a href="/annotate/853dcd4de2a6/primes.py#12" |
|
354 | 354 | title="853dcd4de2a6: a">test@0</a> |
|
355 | 355 | </td> |
|
356 | 356 | <td class="source"><a href="#l12" id="l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td> |
|
357 | 357 | </tr> |
|
358 | 358 | <tr class="parity0"> |
|
359 | 359 | <td class="annotate"> |
|
360 | 360 | <a href="/annotate/853dcd4de2a6/primes.py#13" |
|
361 | 361 | title="853dcd4de2a6: a">test@0</a> |
|
362 | 362 | </td> |
|
363 | 363 | <td class="source"><a href="#l13" id="l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
|
364 | 364 | </tr> |
|
365 | 365 | <tr class="parity1"> |
|
366 | 366 | <td class="annotate"> |
|
367 | 367 | <a href="/annotate/853dcd4de2a6/primes.py#14" |
|
368 | 368 | title="853dcd4de2a6: a">test@0</a> |
|
369 | 369 | </td> |
|
370 | 370 | <td class="source"><a href="#l14" id="l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td> |
|
371 | 371 | </tr> |
|
372 | 372 | <tr class="parity0"> |
|
373 | 373 | <td class="annotate"> |
|
374 | 374 | <a href="/annotate/853dcd4de2a6/primes.py#15" |
|
375 | 375 | title="853dcd4de2a6: a">test@0</a> |
|
376 | 376 | </td> |
|
377 | 377 | <td class="source"><a href="#l15" id="l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td> |
|
378 | 378 | </tr> |
|
379 | 379 | <tr class="parity1"> |
|
380 | 380 | <td class="annotate"> |
|
381 | 381 | <a href="/annotate/853dcd4de2a6/primes.py#16" |
|
382 | 382 | title="853dcd4de2a6: a">test@0</a> |
|
383 | 383 | </td> |
|
384 | 384 | <td class="source"><a href="#l16" id="l16"> 16</a> <span class="c"># infinite recursion.</span></td> |
|
385 | 385 | </tr> |
|
386 | 386 | <tr class="parity0"> |
|
387 | 387 | <td class="annotate"> |
|
388 | 388 | <a href="/annotate/853dcd4de2a6/primes.py#17" |
|
389 | 389 | title="853dcd4de2a6: a">test@0</a> |
|
390 | 390 | </td> |
|
391 | 391 | <td class="source"><a href="#l17" id="l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td> |
|
392 | 392 | </tr> |
|
393 | 393 | <tr class="parity1"> |
|
394 | 394 | <td class="annotate"> |
|
395 | 395 | <a href="/annotate/853dcd4de2a6/primes.py#18" |
|
396 | 396 | title="853dcd4de2a6: a">test@0</a> |
|
397 | 397 | </td> |
|
398 | 398 | <td class="source"><a href="#l18" id="l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mf">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td> |
|
399 | 399 | </tr> |
|
400 | 400 | <tr class="parity0"> |
|
401 | 401 | <td class="annotate"> |
|
402 | 402 | <a href="/annotate/853dcd4de2a6/primes.py#19" |
|
403 | 403 | title="853dcd4de2a6: a">test@0</a> |
|
404 | 404 | </td> |
|
405 | 405 | <td class="source"><a href="#l19" id="l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
|
406 | 406 | </tr> |
|
407 | 407 | <tr class="parity1"> |
|
408 | 408 | <td class="annotate"> |
|
409 | 409 | <a href="/annotate/853dcd4de2a6/primes.py#20" |
|
410 | 410 | title="853dcd4de2a6: a">test@0</a> |
|
411 | 411 | </td> |
|
412 | 412 | <td class="source"><a href="#l20" id="l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td> |
|
413 | 413 | </tr> |
|
414 | 414 | <tr class="parity0"> |
|
415 | 415 | <td class="annotate"> |
|
416 | 416 | <a href="/annotate/853dcd4de2a6/primes.py#21" |
|
417 | 417 | title="853dcd4de2a6: a">test@0</a> |
|
418 | 418 | </td> |
|
419 | 419 | <td class="source"><a href="#l21" id="l21"> 21</a> </td> |
|
420 | 420 | </tr> |
|
421 | 421 | <tr class="parity1"> |
|
422 | 422 | <td class="annotate"> |
|
423 | 423 | <a href="/annotate/853dcd4de2a6/primes.py#22" |
|
424 | 424 | title="853dcd4de2a6: a">test@0</a> |
|
425 | 425 | </td> |
|
426 | 426 | <td class="source"><a href="#l22" id="l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mf">2</span> <span class="o">==</span> <span class="mf">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td> |
|
427 | 427 | </tr> |
|
428 | 428 | <tr class="parity0"> |
|
429 | 429 | <td class="annotate"> |
|
430 | 430 | <a href="/annotate/853dcd4de2a6/primes.py#23" |
|
431 | 431 | title="853dcd4de2a6: a">test@0</a> |
|
432 | 432 | </td> |
|
433 | 433 | <td class="source"><a href="#l23" id="l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mf">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mf">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td> |
|
434 | 434 | </tr> |
|
435 | 435 | <tr class="parity1"> |
|
436 | 436 | <td class="annotate"> |
|
437 | 437 | <a href="/annotate/853dcd4de2a6/primes.py#24" |
|
438 | 438 | title="853dcd4de2a6: a">test@0</a> |
|
439 | 439 | </td> |
|
440 | 440 | <td class="source"><a href="#l24" id="l24"> 24</a> </td> |
|
441 | 441 | </tr> |
|
442 | 442 | <tr class="parity0"> |
|
443 | 443 | <td class="annotate"> |
|
444 | 444 | <a href="/annotate/853dcd4de2a6/primes.py#25" |
|
445 | 445 | title="853dcd4de2a6: a">test@0</a> |
|
446 | 446 | </td> |
|
447 | 447 | <td class="source"><a href="#l25" id="l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td> |
|
448 | 448 | </tr> |
|
449 | 449 | <tr class="parity1"> |
|
450 | 450 | <td class="annotate"> |
|
451 | 451 | <a href="/annotate/853dcd4de2a6/primes.py#26" |
|
452 | 452 | title="853dcd4de2a6: a">test@0</a> |
|
453 | 453 | </td> |
|
454 | 454 | <td class="source"><a href="#l26" id="l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td> |
|
455 | 455 | </tr> |
|
456 | 456 | <tr class="parity0"> |
|
457 | 457 | <td class="annotate"> |
|
458 | 458 | <a href="/annotate/853dcd4de2a6/primes.py#27" |
|
459 | 459 | title="853dcd4de2a6: a">test@0</a> |
|
460 | 460 | </td> |
|
461 | 461 | <td class="source"><a href="#l27" id="l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td> |
|
462 | 462 | </tr> |
|
463 | 463 | <tr class="parity1"> |
|
464 | 464 | <td class="annotate"> |
|
465 | 465 | <a href="/annotate/853dcd4de2a6/primes.py#28" |
|
466 | 466 | title="853dcd4de2a6: a">test@0</a> |
|
467 | 467 | </td> |
|
468 | 468 | <td class="source"><a href="#l28" id="l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td> |
|
469 | 469 | </tr> |
|
470 | 470 | <tr class="parity0"> |
|
471 | 471 | <td class="annotate"> |
|
472 | 472 | <a href="/annotate/853dcd4de2a6/primes.py#29" |
|
473 | 473 | title="853dcd4de2a6: a">test@0</a> |
|
474 | 474 | </td> |
|
475 | 475 | <td class="source"><a href="#l29" id="l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td> |
|
476 | 476 | </tr> |
|
477 | 477 | <tr class="parity1"> |
|
478 | 478 | <td class="annotate"> |
|
479 | 479 | <a href="/annotate/853dcd4de2a6/primes.py#30" |
|
480 | 480 | title="853dcd4de2a6: a">test@0</a> |
|
481 | 481 | </td> |
|
482 | 482 | <td class="source"><a href="#l30" id="l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mf">10</span></td> |
|
483 | 483 | </tr> |
|
484 | 484 | <tr class="parity0"> |
|
485 | 485 | <td class="annotate"> |
|
486 | 486 | <a href="/annotate/853dcd4de2a6/primes.py#31" |
|
487 | 487 | title="853dcd4de2a6: a">test@0</a> |
|
488 | 488 | </td> |
|
489 | 489 | <td class="source"><a href="#l31" id="l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td> |
|
490 | 490 | </tr> |
|
491 | 491 | <tr class="parity1"> |
|
492 | 492 | <td class="annotate"> |
|
493 | 493 | <a href="/annotate/853dcd4de2a6/primes.py#32" |
|
494 | 494 | title="853dcd4de2a6: a">test@0</a> |
|
495 | 495 | </td> |
|
496 | 496 | <td class="source"><a href="#l32" id="l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td> |
|
497 | 497 | </tr> |
|
498 | 498 | </table> |
|
499 | 499 | </div> |
|
500 | 500 | </div> |
|
501 | 501 | </div> |
|
502 | 502 | |
|
503 | 503 | <script type="text/javascript">process_dates()</script> |
|
504 | 504 | |
|
505 | 505 | |
|
506 | 506 | </body> |
|
507 | 507 | </html> |
|
508 | 508 | |
|
509 | 509 | |
|
510 | 510 | hgweb fileannotate, raw |
|
511 | 511 | |
|
512 | 512 | $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/primes.py?style=raw') \ |
|
513 | 513 | > | sed "s/test@//" > a |
|
514 | 514 | $ echo "200 Script output follows" > b |
|
515 | 515 | $ echo "" >> b |
|
516 | 516 | $ echo "" >> b |
|
517 | 517 | $ hg annotate "primes.py" >> b |
|
518 | 518 | $ echo "" >> b |
|
519 | 519 | $ echo "" >> b |
|
520 | 520 | $ echo "" >> b |
|
521 | 521 | $ echo "" >> b |
|
522 | 522 | $ diff -u b a |
|
523 | $ echo | |
|
524 | ||
|
525 | 523 | |
|
526 | 524 | hgweb filerevision, raw |
|
527 | 525 | |
|
528 | 526 | $ ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/primes.py?style=raw') \ |
|
529 | 527 | > > a |
|
530 | 528 | $ echo "200 Script output follows" > b |
|
531 | 529 | $ echo "" >> b |
|
532 | 530 | $ hg cat primes.py >> b |
|
533 | 531 | $ diff -u b a |
|
534 | $ echo | |
|
535 | ||
|
536 | 532 | |
|
537 | 533 | hgweb highlightcss friendly |
|
538 | 534 | |
|
539 | 535 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out |
|
540 | 536 | $ head -n 4 out |
|
541 | 537 | 200 Script output follows |
|
542 | 538 | |
|
543 | 539 | /* pygments_style = friendly */ |
|
544 | 540 | |
|
545 | 541 | $ rm out |
|
546 | 542 | |
|
547 | 543 | errors encountered |
|
548 | 544 | |
|
549 | 545 | $ cat errors.log |
|
550 | 546 | $ "$TESTDIR/killdaemons.py" |
|
551 | 547 | |
|
552 | 548 | Change the pygments style |
|
553 | 549 | |
|
554 | 550 | $ cat > .hg/hgrc <<EOF |
|
555 | 551 | > [web] |
|
556 | 552 | > pygments_style = fruity |
|
557 | 553 | > EOF |
|
558 | 554 | |
|
559 | 555 | hg serve again |
|
560 | 556 | |
|
561 | 557 | $ hg serve -p $HGPORT -d -n test --pid-file=hg.pid -A access.log -E errors.log |
|
562 | 558 | $ cat hg.pid >> $DAEMON_PIDS |
|
563 | 559 | |
|
564 | 560 | hgweb highlightcss fruity |
|
565 | 561 | |
|
566 | 562 | $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/highlightcss' > out |
|
567 | 563 | $ head -n 4 out |
|
568 | 564 | 200 Script output follows |
|
569 | 565 | |
|
570 | 566 | /* pygments_style = fruity */ |
|
571 | 567 | |
|
572 | 568 | $ rm out |
|
573 | 569 | |
|
574 | 570 | errors encountered |
|
575 | 571 | |
|
576 | 572 | $ cat errors.log |
|
577 | 573 | $ cd .. |
|
578 | 574 | $ hg init eucjp |
|
579 | 575 | $ cd eucjp |
|
580 | 576 | $ python -c 'print("\265\376")' >> eucjp.txt # Japanese kanji "Kyo" |
|
581 | 577 | $ hg ci -Ama |
|
582 | 578 | adding eucjp.txt |
|
583 | 579 | $ hgserveget () { |
|
584 | 580 | > "$TESTDIR/killdaemons.py" |
|
585 | 581 | > echo % HGENCODING="$1" hg serve |
|
586 | 582 | > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log |
|
587 | 583 | > cat hg.pid >> $DAEMON_PIDS |
|
588 | 584 | > |
|
589 | 585 | > echo % hgweb filerevision, html |
|
590 | 586 | > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "/file/tip/$2" \ |
|
591 | 587 | > | grep '<div class="parity0 source">' |
|
592 | 588 | > echo % errors encountered |
|
593 | 589 | > cat errors.log |
|
594 | 590 | > } |
|
595 | 591 | $ hgserveget euc-jp eucjp.txt |
|
596 | 592 | % HGENCODING=euc-jp hg serve |
|
597 | 593 | % hgweb filerevision, html |
|
598 | 594 | <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xb5\xfe</div> (esc) |
|
599 | 595 | % errors encountered |
|
600 | 596 | $ hgserveget utf-8 eucjp.txt |
|
601 | 597 | % HGENCODING=utf-8 hg serve |
|
602 | 598 | % hgweb filerevision, html |
|
603 | 599 | <div class="parity0 source"><a href="#l1" id="l1"> 1</a> \xef\xbf\xbd\xef\xbf\xbd</div> (esc) |
|
604 | 600 | % errors encountered |
|
605 | 601 | $ hgserveget us-ascii eucjp.txt |
|
606 | 602 | % HGENCODING=us-ascii hg serve |
|
607 | 603 | % hgweb filerevision, html |
|
608 | 604 | <div class="parity0 source"><a href="#l1" id="l1"> 1</a> ??</div> |
|
609 | 605 | % errors encountered |
@@ -1,40 +1,38 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ cat > unix2mac.py <<EOF |
|
3 | 3 | > import sys |
|
4 | 4 | > |
|
5 | 5 | > for path in sys.argv[1:]: |
|
6 | 6 | > data = file(path, 'rb').read() |
|
7 | 7 | > data = data.replace('\n', '\r') |
|
8 | 8 | > file(path, 'wb').write(data) |
|
9 | 9 | > EOF |
|
10 | 10 | $ cat > print.py <<EOF |
|
11 | 11 | > import sys |
|
12 | 12 | > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>')) |
|
13 | 13 | > EOF |
|
14 | 14 | $ hg init |
|
15 | 15 | $ echo '[hooks]' >> .hg/hgrc |
|
16 | 16 | $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc |
|
17 | 17 | $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc |
|
18 | 18 | $ cat .hg/hgrc |
|
19 | 19 | [hooks] |
|
20 | 20 | pretxncommit.cr = python:hgext.win32text.forbidcr |
|
21 | 21 | pretxnchangegroup.cr = python:hgext.win32text.forbidcr |
|
22 | $ echo | |
|
23 | ||
|
22 | ||
|
24 | 23 | $ echo hello > f |
|
25 | 24 | $ hg add f |
|
26 | 25 | $ hg ci -m 1 |
|
27 | $ echo | |
|
28 | ||
|
26 | ||
|
29 | 27 | $ python unix2mac.py f |
|
30 | 28 | $ hg ci -m 2 |
|
31 | 29 | Attempt to commit or push text file(s) using CR line endings |
|
32 | 30 | in dea860dc51ec: f |
|
33 | 31 | transaction abort! |
|
34 | 32 | rollback completed |
|
35 | 33 | abort: pretxncommit.cr hook failed |
|
36 | 34 | [255] |
|
37 | 35 | $ hg cat f | python print.py |
|
38 | 36 | hello<LF> |
|
39 | 37 | $ cat f | python print.py |
|
40 | 38 | hello<CR> |
@@ -1,778 +1,720 b'' | |||
|
1 | 1 | test merge-tools configuration - mostly exercising filemerge.py |
|
2 | 2 | |
|
3 | 3 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test |
|
4 | 4 | $ hg init |
|
5 | 5 | |
|
6 | 6 | revision 0 |
|
7 | 7 | |
|
8 | 8 | $ echo "revision 0" > f |
|
9 | 9 | $ echo "space" >> f |
|
10 | 10 | $ hg commit -Am "revision 0" |
|
11 | 11 | adding f |
|
12 | 12 | |
|
13 | 13 | revision 1 |
|
14 | 14 | |
|
15 | 15 | $ echo "revision 1" > f |
|
16 | 16 | $ echo "space" >> f |
|
17 | 17 | $ hg commit -Am "revision 1" |
|
18 | 18 | $ hg update 0 > /dev/null |
|
19 | 19 | |
|
20 | 20 | revision 2 |
|
21 | 21 | |
|
22 | 22 | $ echo "revision 2" > f |
|
23 | 23 | $ echo "space" >> f |
|
24 | 24 | $ hg commit -Am "revision 2" |
|
25 | 25 | created new head |
|
26 | 26 | $ hg update 0 > /dev/null |
|
27 | 27 | |
|
28 | 28 | revision 3 - simple to merge |
|
29 | 29 | |
|
30 | 30 | $ echo "revision 3" >> f |
|
31 | 31 | $ hg commit -Am "revision 3" |
|
32 | 32 | created new head |
|
33 | 33 | $ echo "[merge-tools]" > .hg/hgrc |
|
34 | $ echo | |
|
35 | ||
|
34 | ||
|
36 | 35 | $ beforemerge() { |
|
37 | 36 | > cat .hg/hgrc |
|
38 | 37 | > echo "# hg update -C 1" |
|
39 | 38 | > hg update -C 1 > /dev/null |
|
40 | 39 | > } |
|
41 | 40 | $ aftermerge() { |
|
42 | 41 | > echo "# cat f" |
|
43 | 42 | > cat f |
|
44 | 43 | > echo "# hg stat" |
|
45 | 44 | > hg stat |
|
46 | 45 | > rm -f f.orig |
|
47 | > echo | |
|
48 | 46 | > } |
|
49 | 47 | $ domerge() { |
|
50 | 48 | > beforemerge |
|
51 | 49 | > echo "# hg merge $*" |
|
52 | 50 | > hg merge $* |
|
53 | 51 | > aftermerge |
|
54 | 52 | > } |
|
55 | $ echo | |
|
56 | ||
|
57 | 53 | |
|
58 | 54 | Tool selection |
|
59 | 55 | |
|
60 | $ echo | |
|
61 | ||
|
62 | ||
|
63 | 56 | default is internal merge: |
|
64 | 57 | |
|
65 | 58 | $ beforemerge |
|
66 | 59 | [merge-tools] |
|
67 | 60 | # hg update -C 1 |
|
68 | 61 | |
|
69 | 62 | hg merge -r 2 |
|
70 | 63 | override $PATH to ensure hgmerge not visible; use $PYTHON in case we're |
|
71 | 64 | running from a devel copy, not a temp installation |
|
72 | 65 | |
|
73 | 66 | $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2 |
|
74 | 67 | merging f |
|
75 | 68 | warning: conflicts during merge. |
|
76 | 69 | merging f failed! |
|
77 | 70 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
78 | 71 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
79 | 72 | [1] |
|
80 | 73 | $ aftermerge |
|
81 | 74 | # cat f |
|
82 | 75 | <<<<<<< local |
|
83 | 76 | revision 1 |
|
84 | 77 | ======= |
|
85 | 78 | revision 2 |
|
86 | 79 | >>>>>>> other |
|
87 | 80 | space |
|
88 | 81 | # hg stat |
|
89 | 82 | M f |
|
90 | 83 | ? f.orig |
|
91 | ||
|
92 | 84 | |
|
93 | 85 | simplest hgrc using false for merge: |
|
94 | 86 | |
|
95 | 87 | $ echo "false.whatever=" >> .hg/hgrc |
|
96 | 88 | $ domerge -r 2 |
|
97 | 89 | [merge-tools] |
|
98 | 90 | false.whatever= |
|
99 | 91 | # hg update -C 1 |
|
100 | 92 | # hg merge -r 2 |
|
101 | 93 | merging f |
|
102 | 94 | merging f failed! |
|
103 | 95 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
104 | 96 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
105 | 97 | # cat f |
|
106 | 98 | revision 1 |
|
107 | 99 | space |
|
108 | 100 | # hg stat |
|
109 | 101 | M f |
|
110 | 102 | ? f.orig |
|
111 | ||
|
112 | 103 | |
|
113 | 104 | true with higher .priority gets precedence: |
|
114 | 105 | |
|
115 | 106 | $ echo "true.priority=1" >> .hg/hgrc |
|
116 | 107 | $ domerge -r 2 |
|
117 | 108 | [merge-tools] |
|
118 | 109 | false.whatever= |
|
119 | 110 | true.priority=1 |
|
120 | 111 | # hg update -C 1 |
|
121 | 112 | # hg merge -r 2 |
|
122 | 113 | merging f |
|
123 | 114 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
124 | 115 | (branch merge, don't forget to commit) |
|
125 | 116 | # cat f |
|
126 | 117 | revision 1 |
|
127 | 118 | space |
|
128 | 119 | # hg stat |
|
129 | 120 | M f |
|
130 | ||
|
131 | 121 | |
|
132 | 122 | unless lowered on command line: |
|
133 | 123 | |
|
134 | 124 | $ domerge -r 2 --config merge-tools.true.priority=-7 |
|
135 | 125 | [merge-tools] |
|
136 | 126 | false.whatever= |
|
137 | 127 | true.priority=1 |
|
138 | 128 | # hg update -C 1 |
|
139 | 129 | # hg merge -r 2 --config merge-tools.true.priority=-7 |
|
140 | 130 | merging f |
|
141 | 131 | merging f failed! |
|
142 | 132 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
143 | 133 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
144 | 134 | # cat f |
|
145 | 135 | revision 1 |
|
146 | 136 | space |
|
147 | 137 | # hg stat |
|
148 | 138 | M f |
|
149 | 139 | ? f.orig |
|
150 | ||
|
151 | 140 | |
|
152 | 141 | or false set higher on command line: |
|
153 | 142 | |
|
154 | 143 | $ domerge -r 2 --config merge-tools.false.priority=117 |
|
155 | 144 | [merge-tools] |
|
156 | 145 | false.whatever= |
|
157 | 146 | true.priority=1 |
|
158 | 147 | # hg update -C 1 |
|
159 | 148 | # hg merge -r 2 --config merge-tools.false.priority=117 |
|
160 | 149 | merging f |
|
161 | 150 | merging f failed! |
|
162 | 151 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
163 | 152 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
164 | 153 | # cat f |
|
165 | 154 | revision 1 |
|
166 | 155 | space |
|
167 | 156 | # hg stat |
|
168 | 157 | M f |
|
169 | 158 | ? f.orig |
|
170 | ||
|
171 | 159 | |
|
172 | 160 | or true.executable not found in PATH: |
|
173 | 161 | |
|
174 | 162 | $ domerge -r 2 --config merge-tools.true.executable=nonexistingmergetool |
|
175 | 163 | [merge-tools] |
|
176 | 164 | false.whatever= |
|
177 | 165 | true.priority=1 |
|
178 | 166 | # hg update -C 1 |
|
179 | 167 | # hg merge -r 2 --config merge-tools.true.executable=nonexistingmergetool |
|
180 | 168 | merging f |
|
181 | 169 | merging f failed! |
|
182 | 170 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
183 | 171 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
184 | 172 | # cat f |
|
185 | 173 | revision 1 |
|
186 | 174 | space |
|
187 | 175 | # hg stat |
|
188 | 176 | M f |
|
189 | 177 | ? f.orig |
|
190 | ||
|
191 | 178 | |
|
192 | 179 | or true.executable with bogus path: |
|
193 | 180 | |
|
194 | 181 | $ domerge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool |
|
195 | 182 | [merge-tools] |
|
196 | 183 | false.whatever= |
|
197 | 184 | true.priority=1 |
|
198 | 185 | # hg update -C 1 |
|
199 | 186 | # hg merge -r 2 --config merge-tools.true.executable=/nonexisting/mergetool |
|
200 | 187 | merging f |
|
201 | 188 | merging f failed! |
|
202 | 189 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
203 | 190 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
204 | 191 | # cat f |
|
205 | 192 | revision 1 |
|
206 | 193 | space |
|
207 | 194 | # hg stat |
|
208 | 195 | M f |
|
209 | 196 | ? f.orig |
|
210 | ||
|
211 | 197 | |
|
212 | 198 | but true.executable set to cat found in PATH works: |
|
213 | 199 | |
|
214 | 200 | $ echo "true.executable=cat" >> .hg/hgrc |
|
215 | 201 | $ domerge -r 2 |
|
216 | 202 | [merge-tools] |
|
217 | 203 | false.whatever= |
|
218 | 204 | true.priority=1 |
|
219 | 205 | true.executable=cat |
|
220 | 206 | # hg update -C 1 |
|
221 | 207 | # hg merge -r 2 |
|
222 | 208 | merging f |
|
223 | 209 | revision 1 |
|
224 | 210 | space |
|
225 | 211 | revision 0 |
|
226 | 212 | space |
|
227 | 213 | revision 2 |
|
228 | 214 | space |
|
229 | 215 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
230 | 216 | (branch merge, don't forget to commit) |
|
231 | 217 | # cat f |
|
232 | 218 | revision 1 |
|
233 | 219 | space |
|
234 | 220 | # hg stat |
|
235 | 221 | M f |
|
236 | ||
|
237 | 222 | |
|
238 | 223 | and true.executable set to cat with path works: |
|
239 | 224 | |
|
240 | 225 | $ domerge -r 2 --config merge-tools.true.executable=cat |
|
241 | 226 | [merge-tools] |
|
242 | 227 | false.whatever= |
|
243 | 228 | true.priority=1 |
|
244 | 229 | true.executable=cat |
|
245 | 230 | # hg update -C 1 |
|
246 | 231 | # hg merge -r 2 --config merge-tools.true.executable=cat |
|
247 | 232 | merging f |
|
248 | 233 | revision 1 |
|
249 | 234 | space |
|
250 | 235 | revision 0 |
|
251 | 236 | space |
|
252 | 237 | revision 2 |
|
253 | 238 | space |
|
254 | 239 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
255 | 240 | (branch merge, don't forget to commit) |
|
256 | 241 | # cat f |
|
257 | 242 | revision 1 |
|
258 | 243 | space |
|
259 | 244 | # hg stat |
|
260 | 245 | M f |
|
261 | ||
|
262 | $ echo | |
|
263 | ||
|
264 | 246 | |
|
265 | 247 | Tool selection and merge-patterns |
|
266 | 248 | |
|
267 | $ echo | |
|
268 | ||
|
269 | ||
|
270 | 249 | merge-patterns specifies new tool false: |
|
271 | 250 | |
|
272 | 251 | $ domerge -r 2 --config merge-patterns.f=false |
|
273 | 252 | [merge-tools] |
|
274 | 253 | false.whatever= |
|
275 | 254 | true.priority=1 |
|
276 | 255 | true.executable=cat |
|
277 | 256 | # hg update -C 1 |
|
278 | 257 | # hg merge -r 2 --config merge-patterns.f=false |
|
279 | 258 | merging f |
|
280 | 259 | merging f failed! |
|
281 | 260 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
282 | 261 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
283 | 262 | # cat f |
|
284 | 263 | revision 1 |
|
285 | 264 | space |
|
286 | 265 | # hg stat |
|
287 | 266 | M f |
|
288 | 267 | ? f.orig |
|
289 | ||
|
290 | 268 | |
|
291 | 269 | merge-patterns specifies executable not found in PATH and gets warning: |
|
292 | 270 | |
|
293 | 271 | $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool |
|
294 | 272 | [merge-tools] |
|
295 | 273 | false.whatever= |
|
296 | 274 | true.priority=1 |
|
297 | 275 | true.executable=cat |
|
298 | 276 | # hg update -C 1 |
|
299 | 277 | # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistingmergetool |
|
300 | 278 | couldn't find merge tool true specified for f |
|
301 | 279 | merging f |
|
302 | 280 | merging f failed! |
|
303 | 281 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
304 | 282 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
305 | 283 | # cat f |
|
306 | 284 | revision 1 |
|
307 | 285 | space |
|
308 | 286 | # hg stat |
|
309 | 287 | M f |
|
310 | 288 | ? f.orig |
|
311 | ||
|
312 | 289 | |
|
313 | 290 | merge-patterns specifies executable with bogus path and gets warning: |
|
314 | 291 | |
|
315 | 292 | $ domerge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool |
|
316 | 293 | [merge-tools] |
|
317 | 294 | false.whatever= |
|
318 | 295 | true.priority=1 |
|
319 | 296 | true.executable=cat |
|
320 | 297 | # hg update -C 1 |
|
321 | 298 | # hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexisting/mergetool |
|
322 | 299 | couldn't find merge tool true specified for f |
|
323 | 300 | merging f |
|
324 | 301 | merging f failed! |
|
325 | 302 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
326 | 303 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
327 | 304 | # cat f |
|
328 | 305 | revision 1 |
|
329 | 306 | space |
|
330 | 307 | # hg stat |
|
331 | 308 | M f |
|
332 | 309 | ? f.orig |
|
333 | ||
|
334 | $ echo | |
|
335 | ||
|
336 | 310 | |
|
337 | 311 | ui.merge overrules priority |
|
338 | 312 | |
|
339 | $ echo | |
|
340 | ||
|
341 | ||
|
342 | 313 | ui.merge specifies false: |
|
343 | 314 | |
|
344 | 315 | $ domerge -r 2 --config ui.merge=false |
|
345 | 316 | [merge-tools] |
|
346 | 317 | false.whatever= |
|
347 | 318 | true.priority=1 |
|
348 | 319 | true.executable=cat |
|
349 | 320 | # hg update -C 1 |
|
350 | 321 | # hg merge -r 2 --config ui.merge=false |
|
351 | 322 | merging f |
|
352 | 323 | merging f failed! |
|
353 | 324 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
354 | 325 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
355 | 326 | # cat f |
|
356 | 327 | revision 1 |
|
357 | 328 | space |
|
358 | 329 | # hg stat |
|
359 | 330 | M f |
|
360 | 331 | ? f.orig |
|
361 | ||
|
362 | 332 | |
|
363 | 333 | ui.merge specifies internal:fail: |
|
364 | 334 | |
|
365 | 335 | $ domerge -r 2 --config ui.merge=internal:fail |
|
366 | 336 | [merge-tools] |
|
367 | 337 | false.whatever= |
|
368 | 338 | true.priority=1 |
|
369 | 339 | true.executable=cat |
|
370 | 340 | # hg update -C 1 |
|
371 | 341 | # hg merge -r 2 --config ui.merge=internal:fail |
|
372 | 342 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
373 | 343 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
374 | 344 | # cat f |
|
375 | 345 | revision 1 |
|
376 | 346 | space |
|
377 | 347 | # hg stat |
|
378 | 348 | M f |
|
379 | ||
|
380 | 349 | |
|
381 | 350 | ui.merge specifies internal:local: |
|
382 | 351 | |
|
383 | 352 | $ domerge -r 2 --config ui.merge=internal:local |
|
384 | 353 | [merge-tools] |
|
385 | 354 | false.whatever= |
|
386 | 355 | true.priority=1 |
|
387 | 356 | true.executable=cat |
|
388 | 357 | # hg update -C 1 |
|
389 | 358 | # hg merge -r 2 --config ui.merge=internal:local |
|
390 | 359 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
391 | 360 | (branch merge, don't forget to commit) |
|
392 | 361 | # cat f |
|
393 | 362 | revision 1 |
|
394 | 363 | space |
|
395 | 364 | # hg stat |
|
396 | 365 | M f |
|
397 | ||
|
398 | 366 | |
|
399 | 367 | ui.merge specifies internal:other: |
|
400 | 368 | |
|
401 | 369 | $ domerge -r 2 --config ui.merge=internal:other |
|
402 | 370 | [merge-tools] |
|
403 | 371 | false.whatever= |
|
404 | 372 | true.priority=1 |
|
405 | 373 | true.executable=cat |
|
406 | 374 | # hg update -C 1 |
|
407 | 375 | # hg merge -r 2 --config ui.merge=internal:other |
|
408 | 376 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
409 | 377 | (branch merge, don't forget to commit) |
|
410 | 378 | # cat f |
|
411 | 379 | revision 2 |
|
412 | 380 | space |
|
413 | 381 | # hg stat |
|
414 | 382 | M f |
|
415 | ||
|
416 | 383 | |
|
417 | 384 | ui.merge specifies internal:prompt: |
|
418 | 385 | |
|
419 | 386 | $ domerge -r 2 --config ui.merge=internal:prompt |
|
420 | 387 | [merge-tools] |
|
421 | 388 | false.whatever= |
|
422 | 389 | true.priority=1 |
|
423 | 390 | true.executable=cat |
|
424 | 391 | # hg update -C 1 |
|
425 | 392 | # hg merge -r 2 --config ui.merge=internal:prompt |
|
426 | 393 | no tool found to merge f |
|
427 | 394 | keep (l)ocal or take (o)ther? l |
|
428 | 395 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
429 | 396 | (branch merge, don't forget to commit) |
|
430 | 397 | # cat f |
|
431 | 398 | revision 1 |
|
432 | 399 | space |
|
433 | 400 | # hg stat |
|
434 | 401 | M f |
|
435 | ||
|
436 | 402 | |
|
437 | 403 | ui.merge specifies internal:dump: |
|
438 | 404 | |
|
439 | 405 | $ domerge -r 2 --config ui.merge=internal:dump |
|
440 | 406 | [merge-tools] |
|
441 | 407 | false.whatever= |
|
442 | 408 | true.priority=1 |
|
443 | 409 | true.executable=cat |
|
444 | 410 | # hg update -C 1 |
|
445 | 411 | # hg merge -r 2 --config ui.merge=internal:dump |
|
446 | 412 | merging f |
|
447 | 413 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
448 | 414 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
449 | 415 | # cat f |
|
450 | 416 | revision 1 |
|
451 | 417 | space |
|
452 | 418 | # hg stat |
|
453 | 419 | M f |
|
454 | 420 | ? f.base |
|
455 | 421 | ? f.local |
|
456 | 422 | ? f.orig |
|
457 | 423 | ? f.other |
|
458 | ||
|
459 | 424 | |
|
460 | 425 | f.base: |
|
461 | 426 | |
|
462 | 427 | $ cat f.base |
|
463 | 428 | revision 0 |
|
464 | 429 | space |
|
465 | 430 | |
|
466 | 431 | f.local: |
|
467 | 432 | |
|
468 | 433 | $ cat f.local |
|
469 | 434 | revision 1 |
|
470 | 435 | space |
|
471 | 436 | |
|
472 | 437 | f.other: |
|
473 | 438 | |
|
474 | 439 | $ cat f.other |
|
475 | 440 | revision 2 |
|
476 | 441 | space |
|
477 | 442 | $ rm f.base f.local f.other |
|
478 | $ echo | |
|
479 | ||
|
480 | 443 | |
|
481 | 444 | ui.merge specifies internal:other but is overruled by pattern for false: |
|
482 | 445 | |
|
483 | 446 | $ domerge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
|
484 | 447 | [merge-tools] |
|
485 | 448 | false.whatever= |
|
486 | 449 | true.priority=1 |
|
487 | 450 | true.executable=cat |
|
488 | 451 | # hg update -C 1 |
|
489 | 452 | # hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false |
|
490 | 453 | merging f |
|
491 | 454 | merging f failed! |
|
492 | 455 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
493 | 456 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
494 | 457 | # cat f |
|
495 | 458 | revision 1 |
|
496 | 459 | space |
|
497 | 460 | # hg stat |
|
498 | 461 | M f |
|
499 | 462 | ? f.orig |
|
500 | ||
|
501 | $ echo | |
|
502 | ||
|
503 | 463 | |
|
504 | 464 | Premerge |
|
505 | 465 | |
|
506 | $ echo | |
|
507 | ||
|
508 | ||
|
509 | 466 | ui.merge specifies internal:other but is overruled by --tool=false |
|
510 | 467 | |
|
511 | 468 | $ domerge -r 2 --config ui.merge=internal:other --tool=false |
|
512 | 469 | [merge-tools] |
|
513 | 470 | false.whatever= |
|
514 | 471 | true.priority=1 |
|
515 | 472 | true.executable=cat |
|
516 | 473 | # hg update -C 1 |
|
517 | 474 | # hg merge -r 2 --config ui.merge=internal:other --tool=false |
|
518 | 475 | merging f |
|
519 | 476 | merging f failed! |
|
520 | 477 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
521 | 478 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
522 | 479 | # cat f |
|
523 | 480 | revision 1 |
|
524 | 481 | space |
|
525 | 482 | # hg stat |
|
526 | 483 | M f |
|
527 | 484 | ? f.orig |
|
528 | ||
|
485 | ||
|
529 | 486 | HGMERGE specifies internal:other but is overruled by --tool=false |
|
530 | 487 | |
|
531 | 488 | $ HGMERGE=internal:other ; export HGMERGE |
|
532 | 489 | $ domerge -r 2 --tool=false |
|
533 | 490 | [merge-tools] |
|
534 | 491 | false.whatever= |
|
535 | 492 | true.priority=1 |
|
536 | 493 | true.executable=cat |
|
537 | 494 | # hg update -C 1 |
|
538 | 495 | # hg merge -r 2 --tool=false |
|
539 | 496 | merging f |
|
540 | 497 | merging f failed! |
|
541 | 498 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
542 | 499 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
543 | 500 | # cat f |
|
544 | 501 | revision 1 |
|
545 | 502 | space |
|
546 | 503 | # hg stat |
|
547 | 504 | M f |
|
548 | 505 | ? f.orig |
|
549 | ||
|
506 | ||
|
550 | 507 | $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests |
|
551 | 508 | |
|
552 | 509 | Default is silent simplemerge: |
|
553 | 510 | |
|
554 | 511 | $ domerge -r 3 |
|
555 | 512 | [merge-tools] |
|
556 | 513 | false.whatever= |
|
557 | 514 | true.priority=1 |
|
558 | 515 | true.executable=cat |
|
559 | 516 | # hg update -C 1 |
|
560 | 517 | # hg merge -r 3 |
|
561 | 518 | merging f |
|
562 | 519 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
563 | 520 | (branch merge, don't forget to commit) |
|
564 | 521 | # cat f |
|
565 | 522 | revision 1 |
|
566 | 523 | space |
|
567 | 524 | revision 3 |
|
568 | 525 | # hg stat |
|
569 | 526 | M f |
|
570 | ||
|
571 | 527 | |
|
572 | 528 | .premerge=True is same: |
|
573 | 529 | |
|
574 | 530 | $ domerge -r 3 --config merge-tools.true.premerge=True |
|
575 | 531 | [merge-tools] |
|
576 | 532 | false.whatever= |
|
577 | 533 | true.priority=1 |
|
578 | 534 | true.executable=cat |
|
579 | 535 | # hg update -C 1 |
|
580 | 536 | # hg merge -r 3 --config merge-tools.true.premerge=True |
|
581 | 537 | merging f |
|
582 | 538 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
583 | 539 | (branch merge, don't forget to commit) |
|
584 | 540 | # cat f |
|
585 | 541 | revision 1 |
|
586 | 542 | space |
|
587 | 543 | revision 3 |
|
588 | 544 | # hg stat |
|
589 | 545 | M f |
|
590 | ||
|
591 | 546 | |
|
592 | 547 | .premerge=False executes merge-tool: |
|
593 | 548 | |
|
594 | 549 | $ domerge -r 3 --config merge-tools.true.premerge=False |
|
595 | 550 | [merge-tools] |
|
596 | 551 | false.whatever= |
|
597 | 552 | true.priority=1 |
|
598 | 553 | true.executable=cat |
|
599 | 554 | # hg update -C 1 |
|
600 | 555 | # hg merge -r 3 --config merge-tools.true.premerge=False |
|
601 | 556 | merging f |
|
602 | 557 | revision 1 |
|
603 | 558 | space |
|
604 | 559 | revision 0 |
|
605 | 560 | space |
|
606 | 561 | revision 0 |
|
607 | 562 | space |
|
608 | 563 | revision 3 |
|
609 | 564 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
610 | 565 | (branch merge, don't forget to commit) |
|
611 | 566 | # cat f |
|
612 | 567 | revision 1 |
|
613 | 568 | space |
|
614 | 569 | # hg stat |
|
615 | 570 | M f |
|
616 | ||
|
617 | $ echo | |
|
618 | ||
|
619 | 571 | |
|
620 | 572 | Tool execution |
|
621 | 573 | |
|
622 | $ echo | |
|
623 | ||
|
624 | $ echo '# set tools.args explicit to include $base $local $other $output:' # default '$local $base $other' | |
|
625 | # set tools.args explicit to include $base $local $other $output: | |
|
574 | set tools.args explicit to include $base $local $other $output: | |
|
575 | ||
|
626 | 576 | $ beforemerge |
|
627 | 577 | [merge-tools] |
|
628 | 578 | false.whatever= |
|
629 | 579 | true.priority=1 |
|
630 | 580 | true.executable=cat |
|
631 | 581 | # hg update -C 1 |
|
632 | 582 | $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \ |
|
633 | 583 | > | sed 's,==> .* <==,==> ... <==,g' |
|
634 | 584 | merging f |
|
635 | 585 | ==> ... <== |
|
636 | 586 | revision 0 |
|
637 | 587 | space |
|
638 | 588 | |
|
639 | 589 | ==> ... <== |
|
640 | 590 | revision 1 |
|
641 | 591 | space |
|
642 | 592 | |
|
643 | 593 | ==> ... <== |
|
644 | 594 | revision 2 |
|
645 | 595 | space |
|
646 | 596 | |
|
647 | 597 | ==> ... <== |
|
648 | 598 | revision 1 |
|
649 | 599 | space |
|
650 | 600 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
651 | 601 | (branch merge, don't forget to commit) |
|
652 | 602 | $ aftermerge |
|
653 | 603 | # cat f |
|
654 | 604 | revision 1 |
|
655 | 605 | space |
|
656 | 606 | # hg stat |
|
657 | 607 | M f |
|
658 | ||
|
659 |
|
|
|
660 | # Merge with "echo mergeresult > $local": | |
|
608 | ||
|
609 | Merge with "echo mergeresult > $local": | |
|
610 | ||
|
661 | 611 | $ beforemerge |
|
662 | 612 | [merge-tools] |
|
663 | 613 | false.whatever= |
|
664 | 614 | true.priority=1 |
|
665 | 615 | true.executable=cat |
|
666 | 616 | # hg update -C 1 |
|
667 | 617 | $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local' |
|
668 | 618 | merging f |
|
669 | 619 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
670 | 620 | (branch merge, don't forget to commit) |
|
671 | 621 | $ aftermerge |
|
672 | 622 | # cat f |
|
673 | 623 | mergeresult |
|
674 | 624 | # hg stat |
|
675 | 625 | M f |
|
676 | ||
|
677 |
|
|
|
678 | # - and $local is the file f: | |
|
626 | ||
|
627 | - and $local is the file f: | |
|
628 | ||
|
679 | 629 | $ beforemerge |
|
680 | 630 | [merge-tools] |
|
681 | 631 | false.whatever= |
|
682 | 632 | true.priority=1 |
|
683 | 633 | true.executable=cat |
|
684 | 634 | # hg update -C 1 |
|
685 | 635 |
$ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args=' |
|
686 | 636 | merging f |
|
687 | 637 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
688 | 638 |
(branch merge, don' |
|
689 | 639 |
|
|
690 | 640 | # cat f |
|
691 | 641 |
|
|
692 | 642 | # hg stat |
|
693 | 643 |
|
|
694 | ||
|
695 |
|
|
|
696 | # Merge with "echo mergeresult > $output" - the variable is a bit magic: | |
|
644 | ||
|
645 | Merge with "echo mergeresult > $output" - the variable is a bit magic: | |
|
646 | ||
|
697 | 647 | $ beforemerge |
|
698 | 648 | [merge-tools] |
|
699 | 649 |
|
|
700 | 650 | true.priority=1 |
|
701 | 651 |
|
|
702 | 652 | # hg update -C 1 |
|
703 | 653 |
$ hg |
|
704 | 654 |
|
|
705 | 655 |
|
|
706 | 656 |
(branch |
|
707 | 657 | $ aftermerge |
|
708 | 658 | # cat f |
|
709 | 659 | mergeresult |
|
710 | 660 | # hg stat |
|
711 | 661 | M f |
|
712 | ||
|
713 | 662 | |
|
714 | 663 | Merge using tool with a path that must be quoted: |
|
715 | 664 | |
|
716 | 665 | $ beforemerge |
|
717 | 666 | [merge-tools] |
|
718 | 667 | false.whatever= |
|
719 | 668 | true.priority=1 |
|
720 | 669 | true.executable=cat |
|
721 | 670 | # hg update -C 1 |
|
722 | 671 | $ cat <<EOF > 'my merge tool' |
|
723 | 672 | > #!/bin/sh |
|
724 | 673 | > cat "\$1" "\$2" "\$3" > "\$4" |
|
725 | 674 | > EOF |
|
726 | 675 | $ chmod +x 'my merge tool' |
|
727 | 676 | $ hg merge -r 2 --config merge-tools.true.executable='./my merge tool' --config merge-tools.true.args='$base $local $other $output' |
|
728 | 677 | merging f |
|
729 | 678 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
730 | 679 | (branch merge, don't forget to commit) |
|
731 | 680 | $ rm -f 'my merge tool' |
|
732 | 681 | $ aftermerge |
|
733 | 682 | # cat f |
|
734 | 683 | revision 0 |
|
735 | 684 | space |
|
736 | 685 | revision 1 |
|
737 | 686 | space |
|
738 | 687 | revision 2 |
|
739 | 688 | space |
|
740 | 689 | # hg stat |
|
741 | 690 | M f |
|
742 | ||
|
743 | $ echo | |
|
744 | ||
|
745 | 691 | |
|
746 | 692 | Merge post-processing |
|
747 | 693 | |
|
748 | $ echo | |
|
749 | ||
|
750 | ||
|
751 | 694 | cat is a bad merge-tool and doesn't change: |
|
752 | 695 | |
|
753 | 696 | $ domerge -y -r 2 --config merge-tools.true.checkchanged=1 |
|
754 | 697 | [merge-tools] |
|
755 | 698 | false.whatever= |
|
756 | 699 | true.priority=1 |
|
757 | 700 | true.executable=cat |
|
758 | 701 | # hg update -C 1 |
|
759 | 702 | # hg merge -y -r 2 --config merge-tools.true.checkchanged=1 |
|
760 | 703 | merging f |
|
761 | 704 | revision 1 |
|
762 | 705 | space |
|
763 | 706 | revision 0 |
|
764 | 707 | space |
|
765 | 708 | revision 2 |
|
766 | 709 | space |
|
767 | 710 | output file f appears unchanged |
|
768 | 711 | was merge successful (yn)? n |
|
769 | 712 | merging f failed! |
|
770 | 713 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
771 | 714 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
772 | 715 | # cat f |
|
773 | 716 | revision 1 |
|
774 | 717 | space |
|
775 | 718 | # hg stat |
|
776 | 719 | M f |
|
777 | 720 | ? f.orig |
|
778 |
@@ -1,172 +1,171 b'' | |||
|
1 | 1 | $ cat <<EOF > merge |
|
2 | 2 | > import sys, os |
|
3 | 3 | > |
|
4 | 4 | > try: |
|
5 | 5 | > import msvcrt |
|
6 | 6 | > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
7 | 7 | > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
8 | 8 | > except ImportError: |
|
9 | 9 | > pass |
|
10 | 10 | > |
|
11 | 11 | > print "merging for", os.path.basename(sys.argv[1]) |
|
12 | 12 | > EOF |
|
13 | 13 | $ HGMERGE="python ../merge"; export HGMERGE |
|
14 | 14 | |
|
15 | 15 | $ hg init t |
|
16 | 16 | $ cd t |
|
17 | 17 | $ echo This is file a1 > a |
|
18 | 18 | $ hg add a |
|
19 | 19 | $ hg commit -m "commit #0" |
|
20 | 20 | $ echo This is file b1 > b |
|
21 | 21 | $ hg add b |
|
22 | 22 | $ hg commit -m "commit #1" |
|
23 | 23 | |
|
24 | 24 | $ hg update 0 |
|
25 | 25 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
26 | 26 | $ echo This is file c1 > c |
|
27 | 27 | $ hg add c |
|
28 | 28 | $ hg commit -m "commit #2" |
|
29 | 29 | created new head |
|
30 | 30 | $ echo This is file b1 > b |
|
31 | 31 | no merges expected |
|
32 | 32 | $ hg merge -P 1 |
|
33 | 33 | changeset: 1:b8bb4a988f25 |
|
34 | 34 | user: test |
|
35 | 35 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
36 | 36 | summary: commit #1 |
|
37 | 37 | |
|
38 | 38 | $ hg merge 1 |
|
39 | 39 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
40 | 40 | (branch merge, don't forget to commit) |
|
41 | 41 | $ hg diff --nodates |
|
42 | 42 | diff -r 49035e18a8e6 b |
|
43 | 43 | --- /dev/null |
|
44 | 44 | +++ b/b |
|
45 | 45 | @@ -0,0 +1,1 @@ |
|
46 | 46 | +This is file b1 |
|
47 | 47 | $ hg status |
|
48 | 48 | M b |
|
49 | 49 | $ cd ..; rm -r t |
|
50 | 50 | |
|
51 | 51 | $ hg init t |
|
52 | 52 | $ cd t |
|
53 | 53 | $ echo This is file a1 > a |
|
54 | 54 | $ hg add a |
|
55 | 55 | $ hg commit -m "commit #0" |
|
56 | 56 | $ echo This is file b1 > b |
|
57 | 57 | $ hg add b |
|
58 | 58 | $ hg commit -m "commit #1" |
|
59 | 59 | |
|
60 | 60 | $ hg update 0 |
|
61 | 61 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
62 | 62 | $ echo This is file c1 > c |
|
63 | 63 | $ hg add c |
|
64 | 64 | $ hg commit -m "commit #2" |
|
65 | 65 | created new head |
|
66 | 66 | $ echo This is file b2 > b |
|
67 | 67 | merge should fail |
|
68 | 68 | $ hg merge 1 |
|
69 | 69 | abort: untracked file in working directory differs from file in requested revision: 'b' |
|
70 | 70 | [255] |
|
71 | 71 | merge of b expected |
|
72 | 72 | $ hg merge -f 1 |
|
73 | 73 | merging b |
|
74 | 74 | merging for b |
|
75 | 75 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
76 | 76 | (branch merge, don't forget to commit) |
|
77 | 77 | $ hg diff --nodates |
|
78 | 78 | diff -r 49035e18a8e6 b |
|
79 | 79 | --- /dev/null |
|
80 | 80 | +++ b/b |
|
81 | 81 | @@ -0,0 +1,1 @@ |
|
82 | 82 | +This is file b2 |
|
83 | 83 | $ hg status |
|
84 | 84 | M b |
|
85 | 85 | $ cd ..; rm -r t |
|
86 | 86 | |
|
87 | 87 | $ hg init t |
|
88 | 88 | $ cd t |
|
89 | 89 | $ echo This is file a1 > a |
|
90 | 90 | $ hg add a |
|
91 | 91 | $ hg commit -m "commit #0" |
|
92 | 92 | $ echo This is file b1 > b |
|
93 | 93 | $ hg add b |
|
94 | 94 | $ hg commit -m "commit #1" |
|
95 | 95 | $ echo This is file b22 > b |
|
96 | 96 | $ hg commit -m "commit #2" |
|
97 | 97 | $ hg update 1 |
|
98 | 98 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
99 | 99 | $ echo This is file c1 > c |
|
100 | 100 | $ hg add c |
|
101 | 101 | $ hg commit -m "commit #3" |
|
102 | 102 | created new head |
|
103 | 103 | |
|
104 | 104 | Contents of b should be "this is file b1" |
|
105 | 105 | $ cat b |
|
106 | 106 | This is file b1 |
|
107 | 107 | |
|
108 | 108 | $ echo This is file b22 > b |
|
109 | 109 | merge fails |
|
110 | 110 | $ hg merge 2 |
|
111 | 111 | abort: outstanding uncommitted changes (use 'hg status' to list changes) |
|
112 | 112 | [255] |
|
113 |
|
|
|
114 | %% merge expected! | |
|
113 | merge expected! | |
|
115 | 114 | $ hg merge -f 2 |
|
116 | 115 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
117 | 116 | (branch merge, don't forget to commit) |
|
118 | 117 | $ hg diff --nodates |
|
119 | 118 | diff -r 85de557015a8 b |
|
120 | 119 | --- a/b |
|
121 | 120 | +++ b/b |
|
122 | 121 | @@ -1,1 +1,1 @@ |
|
123 | 122 | -This is file b1 |
|
124 | 123 | +This is file b22 |
|
125 | 124 | $ hg status |
|
126 | 125 | M b |
|
127 | 126 | $ cd ..; rm -r t |
|
128 | 127 | |
|
129 | 128 | $ hg init t |
|
130 | 129 | $ cd t |
|
131 | 130 | $ echo This is file a1 > a |
|
132 | 131 | $ hg add a |
|
133 | 132 | $ hg commit -m "commit #0" |
|
134 | 133 | $ echo This is file b1 > b |
|
135 | 134 | $ hg add b |
|
136 | 135 | $ hg commit -m "commit #1" |
|
137 | 136 | $ echo This is file b22 > b |
|
138 | 137 | $ hg commit -m "commit #2" |
|
139 | 138 | $ hg update 1 |
|
140 | 139 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
141 | 140 | $ echo This is file c1 > c |
|
142 | 141 | $ hg add c |
|
143 | 142 | $ hg commit -m "commit #3" |
|
144 | 143 | created new head |
|
145 | 144 | $ echo This is file b33 > b |
|
146 | 145 | merge of b should fail |
|
147 | 146 | $ hg merge 2 |
|
148 | 147 | abort: outstanding uncommitted changes (use 'hg status' to list changes) |
|
149 | 148 | [255] |
|
150 | 149 | merge of b expected |
|
151 | 150 | $ hg merge -f 2 |
|
152 | 151 | merging b |
|
153 | 152 | merging for b |
|
154 | 153 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
155 | 154 | (branch merge, don't forget to commit) |
|
156 | 155 | $ hg diff --nodates |
|
157 | 156 | diff -r 85de557015a8 b |
|
158 | 157 | --- a/b |
|
159 | 158 | +++ b/b |
|
160 | 159 | @@ -1,1 +1,1 @@ |
|
161 | 160 | -This is file b1 |
|
162 | 161 | +This is file b33 |
|
163 | 162 | $ hg status |
|
164 | 163 | M b |
|
165 | 164 | |
|
166 | 165 | Test for issue2364 |
|
167 | 166 | |
|
168 | 167 | $ hg up -qC . |
|
169 | 168 | $ hg rm b |
|
170 | 169 | $ hg ci -md |
|
171 | 170 | $ hg revert -r -2 b |
|
172 | 171 | $ hg up -q -- -2 |
@@ -1,40 +1,34 b'' | |||
|
1 | 1 | Failed qimport of patches from files should cleanup by recording successfully |
|
2 | 2 | imported patches in series file. |
|
3 | 3 | |
|
4 | 4 | $ echo "[extensions]" >> $HGRCPATH |
|
5 | 5 | $ echo "mq=" >> $HGRCPATH |
|
6 | 6 | $ hg init repo |
|
7 | 7 | $ cd repo |
|
8 | 8 | $ echo a > a |
|
9 | 9 | $ hg ci -Am'add a' |
|
10 | 10 | adding a |
|
11 | 11 | $ cat >b.patch<<EOF |
|
12 | 12 | > diff --git a/a b/a |
|
13 | 13 | > --- a/a |
|
14 | 14 | > +++ b/a |
|
15 | 15 | > @@ -1,1 +1,2 @@ |
|
16 | 16 | > a |
|
17 | 17 | > +b |
|
18 | 18 | > EOF |
|
19 | $ echo | |
|
20 | ||
|
21 | 19 | |
|
22 | 20 | empty series |
|
23 | 21 | |
|
24 | 22 | $ hg qseries |
|
25 | $ echo | |
|
26 | ||
|
27 | 23 | |
|
28 | 24 | qimport valid patch followed by invalid patch |
|
29 | 25 | |
|
30 | 26 | $ hg qimport b.patch fakepatch |
|
31 | 27 | adding b.patch to series file |
|
32 | 28 | abort: unable to read file fakepatch |
|
33 | 29 | [255] |
|
34 | $ echo | |
|
35 | ||
|
36 | 30 | |
|
37 | 31 | valid patches before fail added to series |
|
38 | 32 | |
|
39 | 33 | $ hg qseries |
|
40 | 34 | b.patch |
@@ -1,382 +1,380 b'' | |||
|
1 | 1 | Helper functions: |
|
2 | 2 | |
|
3 | 3 | $ cacheexists() { |
|
4 | 4 | > [ -f .hg/cache/tags ] && echo "tag cache exists" || echo "no tag cache" |
|
5 | 5 | > } |
|
6 | 6 | |
|
7 | 7 | $ dumptags() { |
|
8 | 8 | > rev=$1 |
|
9 | 9 | > echo "rev $rev: .hgtags:" |
|
10 | 10 | > hg cat -r$rev .hgtags |
|
11 | 11 | > } |
|
12 | 12 | |
|
13 | 13 | # XXX need to test that the tag cache works when we strip an old head |
|
14 | 14 | # and add a new one rooted off non-tip: i.e. node and rev of tip are the |
|
15 | 15 | # same, but stuff has changed behind tip. |
|
16 | 16 | |
|
17 | 17 | Setup: |
|
18 | 18 | |
|
19 | 19 | $ hg init t |
|
20 | 20 | $ cd t |
|
21 | 21 | $ cacheexists |
|
22 | 22 | no tag cache |
|
23 | 23 | $ hg id |
|
24 | 24 | 000000000000 tip |
|
25 | 25 | $ cacheexists |
|
26 | 26 | no tag cache |
|
27 | 27 | $ echo a > a |
|
28 | 28 | $ hg add a |
|
29 | 29 | $ hg commit -m "test" |
|
30 | 30 | $ hg co |
|
31 | 31 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
32 | 32 | $ hg identify |
|
33 | 33 | acb14030fe0a tip |
|
34 | 34 | $ cacheexists |
|
35 | 35 | tag cache exists |
|
36 | 36 | |
|
37 | 37 | Try corrupting the cache |
|
38 | 38 | |
|
39 | 39 | $ printf 'a b' > .hg/cache/tags |
|
40 | 40 | $ hg identify |
|
41 | 41 | .hg/cache/tags is corrupt, rebuilding it |
|
42 | 42 | acb14030fe0a tip |
|
43 | 43 | $ cacheexists |
|
44 | 44 | tag cache exists |
|
45 | 45 | $ hg identify |
|
46 | 46 | acb14030fe0a tip |
|
47 | 47 | |
|
48 | 48 | Create local tag with long name: |
|
49 | 49 | |
|
50 | 50 | $ T=`hg identify --debug --id` |
|
51 | 51 | $ hg tag -l "This is a local tag with a really long name!" |
|
52 | 52 | $ hg tags |
|
53 | 53 | tip 0:acb14030fe0a |
|
54 | 54 | This is a local tag with a really long name! 0:acb14030fe0a |
|
55 | 55 | $ rm .hg/localtags |
|
56 | 56 | |
|
57 | 57 | Create a tag behind hg's back: |
|
58 | 58 | |
|
59 | 59 | $ echo "$T first" > .hgtags |
|
60 | 60 | $ cat .hgtags |
|
61 | 61 | acb14030fe0a21b60322c440ad2d20cf7685a376 first |
|
62 | 62 | $ hg add .hgtags |
|
63 | 63 | $ hg commit -m "add tags" |
|
64 | 64 | $ hg tags |
|
65 | 65 | tip 1:b9154636be93 |
|
66 | 66 | first 0:acb14030fe0a |
|
67 | 67 | $ hg identify |
|
68 | 68 | b9154636be93 tip |
|
69 | 69 | |
|
70 | 70 | Repeat with cold tag cache: |
|
71 | 71 | |
|
72 | 72 | $ rm -f .hg/cache/tags |
|
73 | 73 | $ hg identify |
|
74 | 74 | b9154636be93 tip |
|
75 | 75 | |
|
76 | 76 | And again, but now unable to write tag cache: |
|
77 | 77 | |
|
78 | 78 | $ rm -f .hg/cache/tags |
|
79 | 79 | $ chmod 555 .hg |
|
80 | 80 | $ hg identify |
|
81 | 81 | b9154636be93 tip |
|
82 | 82 | $ chmod 755 .hg |
|
83 | 83 | |
|
84 | 84 | Create a branch: |
|
85 | 85 | |
|
86 | 86 | $ echo bb > a |
|
87 | 87 | $ hg status |
|
88 | 88 | M a |
|
89 | 89 | $ hg identify |
|
90 | 90 | b9154636be93+ tip |
|
91 | 91 | $ hg co first |
|
92 | 92 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
93 | 93 | $ hg id |
|
94 | 94 | acb14030fe0a+ first |
|
95 | 95 | $ hg -v id |
|
96 | 96 | acb14030fe0a+ first |
|
97 | 97 | $ hg status |
|
98 | 98 | M a |
|
99 | 99 | $ echo 1 > b |
|
100 | 100 | $ hg add b |
|
101 | 101 | $ hg commit -m "branch" |
|
102 | 102 | created new head |
|
103 | 103 | $ hg id |
|
104 | 104 | c8edf04160c7 tip |
|
105 | 105 | |
|
106 | 106 | Merge the two heads: |
|
107 | 107 | |
|
108 | 108 | $ hg merge 1 |
|
109 | 109 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | (branch merge, don't forget to commit) |
|
111 | 111 | $ hg id |
|
112 | 112 | c8edf04160c7+b9154636be93+ tip |
|
113 | 113 | $ hg status |
|
114 | 114 | M .hgtags |
|
115 | 115 | $ hg commit -m "merge" |
|
116 | 116 | |
|
117 | 117 | Create a fake head, make sure tag not visible afterwards: |
|
118 | 118 | |
|
119 | 119 | $ cp .hgtags tags |
|
120 | 120 | $ hg tag last |
|
121 | 121 | $ hg rm .hgtags |
|
122 | 122 | $ hg commit -m "remove" |
|
123 | 123 | |
|
124 | 124 | $ mv tags .hgtags |
|
125 | 125 | $ hg add .hgtags |
|
126 | 126 | $ hg commit -m "readd" |
|
127 | 127 | $ |
|
128 | 128 | $ hg tags |
|
129 | 129 | tip 6:35ff301afafe |
|
130 | 130 | first 0:acb14030fe0a |
|
131 | 131 | |
|
132 | 132 | Add invalid tags: |
|
133 | 133 | |
|
134 | 134 | $ echo "spam" >> .hgtags |
|
135 | 135 | $ echo >> .hgtags |
|
136 | 136 | $ echo "foo bar" >> .hgtags |
|
137 | 137 | $ echo "a5a5 invalid" >> .hg/localtags |
|
138 | $ echo "committing .hgtags:" | |
|
139 | committing .hgtags: | |
|
140 | 138 | $ cat .hgtags |
|
141 | 139 | acb14030fe0a21b60322c440ad2d20cf7685a376 first |
|
142 | 140 | spam |
|
143 | 141 | |
|
144 | 142 | foo bar |
|
145 | 143 | $ hg commit -m "tags" |
|
146 | 144 | |
|
147 | 145 | Report tag parse error on other head: |
|
148 | 146 | |
|
149 | 147 | $ hg up 3 |
|
150 | 148 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
151 | 149 | $ echo 'x y' >> .hgtags |
|
152 | 150 | $ hg commit -m "head" |
|
153 | 151 | created new head |
|
154 | 152 | |
|
155 | 153 | $ hg tags |
|
156 | 154 | .hgtags@75d9f02dfe28, line 2: cannot parse entry |
|
157 | 155 | .hgtags@75d9f02dfe28, line 4: node 'foo' is not well formed |
|
158 | 156 | .hgtags@c4be69a18c11, line 2: node 'x' is not well formed |
|
159 | 157 | tip 8:c4be69a18c11 |
|
160 | 158 | first 0:acb14030fe0a |
|
161 | 159 | $ hg tip |
|
162 | 160 | changeset: 8:c4be69a18c11 |
|
163 | 161 | tag: tip |
|
164 | 162 | parent: 3:ac5e980c4dc0 |
|
165 | 163 | user: test |
|
166 | 164 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
167 | 165 | summary: head |
|
168 | 166 | |
|
169 | 167 | |
|
170 | 168 | Test tag precedence rules: |
|
171 | 169 | |
|
172 | 170 | $ cd .. |
|
173 | 171 | $ hg init t2 |
|
174 | 172 | $ cd t2 |
|
175 | 173 | $ echo foo > foo |
|
176 | 174 | $ hg add foo |
|
177 | 175 | $ hg ci -m 'add foo' # rev 0 |
|
178 | 176 | $ hg tag bar # rev 1 |
|
179 | 177 | $ echo >> foo |
|
180 | 178 | $ hg ci -m 'change foo 1' # rev 2 |
|
181 | 179 | $ hg up -C 1 |
|
182 | 180 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
183 | 181 | $ hg tag -r 1 -f bar # rev 3 |
|
184 | 182 | $ hg up -C 1 |
|
185 | 183 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
186 | 184 | $ echo >> foo |
|
187 | 185 | $ hg ci -m 'change foo 2' # rev 4 |
|
188 | 186 | created new head |
|
189 | 187 | $ hg tags |
|
190 | 188 | tip 4:0c192d7d5e6b |
|
191 | 189 | bar 1:78391a272241 |
|
192 | 190 | |
|
193 | 191 | Repeat in case of cache effects: |
|
194 | 192 | |
|
195 | 193 | $ hg tags |
|
196 | 194 | tip 4:0c192d7d5e6b |
|
197 | 195 | bar 1:78391a272241 |
|
198 | 196 | |
|
199 | 197 | Detailed dump of tag info: |
|
200 | 198 | |
|
201 | 199 | $ hg heads -q # expect 4, 3, 2 |
|
202 | 200 | 4:0c192d7d5e6b |
|
203 | 201 | 3:6fa450212aeb |
|
204 | 202 | 2:7a94127795a3 |
|
205 | 203 | $ dumptags 2 |
|
206 | 204 | rev 2: .hgtags: |
|
207 | 205 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
208 | 206 | $ dumptags 3 |
|
209 | 207 | rev 3: .hgtags: |
|
210 | 208 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
211 | 209 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
212 | 210 | 78391a272241d70354aa14c874552cad6b51bb42 bar |
|
213 | 211 | $ dumptags 4 |
|
214 | 212 | rev 4: .hgtags: |
|
215 | 213 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
216 | 214 | |
|
217 | 215 | Dump cache: |
|
218 | 216 | |
|
219 | 217 | $ cat .hg/cache/tags |
|
220 | 218 | 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d |
|
221 | 219 | 3 6fa450212aeb2a21ed616a54aea39a4a27894cd7 7d3b718c964ef37b89e550ebdafd5789e76ce1b0 |
|
222 | 220 | 2 7a94127795a33c10a370c93f731fd9fea0b79af6 0c04f2a8af31de17fab7422878ee5a2dadbc943d |
|
223 | 221 | |
|
224 | 222 | 78391a272241d70354aa14c874552cad6b51bb42 bar |
|
225 | 223 | |
|
226 | 224 | Test tag removal: |
|
227 | 225 | |
|
228 | 226 | $ hg tag --remove bar # rev 5 |
|
229 | 227 | $ hg tip -vp |
|
230 | 228 | changeset: 5:5f6e8655b1c7 |
|
231 | 229 | tag: tip |
|
232 | 230 | user: test |
|
233 | 231 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
234 | 232 | files: .hgtags |
|
235 | 233 | description: |
|
236 | 234 | Removed tag bar |
|
237 | 235 | |
|
238 | 236 | |
|
239 | 237 | diff -r 0c192d7d5e6b -r 5f6e8655b1c7 .hgtags |
|
240 | 238 | --- a/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
241 | 239 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
242 | 240 | @@ -1,1 +1,3 @@ |
|
243 | 241 | bbd179dfa0a71671c253b3ae0aa1513b60d199fa bar |
|
244 | 242 | +78391a272241d70354aa14c874552cad6b51bb42 bar |
|
245 | 243 | +0000000000000000000000000000000000000000 bar |
|
246 | 244 | |
|
247 | 245 | $ hg tags |
|
248 | 246 | tip 5:5f6e8655b1c7 |
|
249 | 247 | $ hg tags # again, try to expose cache bugs |
|
250 | 248 | tip 5:5f6e8655b1c7 |
|
251 | 249 | |
|
252 | 250 | Remove nonexistent tag: |
|
253 | 251 | |
|
254 | 252 | $ hg tag --remove foobar |
|
255 | 253 | abort: tag 'foobar' does not exist |
|
256 | 254 | [255] |
|
257 | 255 | $ hg tip |
|
258 | 256 | changeset: 5:5f6e8655b1c7 |
|
259 | 257 | tag: tip |
|
260 | 258 | user: test |
|
261 | 259 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
262 | 260 | summary: Removed tag bar |
|
263 | 261 | |
|
264 | 262 | |
|
265 | 263 | Undo a tag with rollback: |
|
266 | 264 | |
|
267 | 265 | $ hg rollback # destroy rev 5 (restore bar) |
|
268 | 266 | repository tip rolled back to revision 4 (undo commit) |
|
269 | 267 | working directory now based on revision 4 |
|
270 | 268 | $ hg tags |
|
271 | 269 | tip 4:0c192d7d5e6b |
|
272 | 270 | bar 1:78391a272241 |
|
273 | 271 | $ hg tags |
|
274 | 272 | tip 4:0c192d7d5e6b |
|
275 | 273 | bar 1:78391a272241 |
|
276 | 274 | |
|
277 | 275 | Test tag rank: |
|
278 | 276 | |
|
279 | 277 | $ cd .. |
|
280 | 278 | $ hg init t3 |
|
281 | 279 | $ cd t3 |
|
282 | 280 | $ echo foo > foo |
|
283 | 281 | $ hg add foo |
|
284 | 282 | $ hg ci -m 'add foo' # rev 0 |
|
285 | 283 | $ hg tag -f bar # rev 1 bar -> 0 |
|
286 | 284 | $ hg tag -f bar # rev 2 bar -> 1 |
|
287 | 285 | $ hg tag -fr 0 bar # rev 3 bar -> 0 |
|
288 | 286 | $ hg tag -fr 1 bar # rev 4 bar -> 1 |
|
289 | 287 | $ hg tag -fr 0 bar # rev 5 bar -> 0 |
|
290 | 288 | $ hg tags |
|
291 | 289 | tip 5:85f05169d91d |
|
292 | 290 | bar 0:bbd179dfa0a7 |
|
293 | 291 | $ hg co 3 |
|
294 | 292 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
295 | 293 | $ echo barbar > foo |
|
296 | 294 | $ hg ci -m 'change foo' # rev 6 |
|
297 | 295 | created new head |
|
298 | 296 | $ hg tags |
|
299 | 297 | tip 6:735c3ca72986 |
|
300 | 298 | bar 0:bbd179dfa0a7 |
|
301 | 299 | |
|
302 | 300 | Don't allow moving tag without -f: |
|
303 | 301 | |
|
304 | 302 | $ hg tag -r 3 bar |
|
305 | 303 | abort: tag 'bar' already exists (use -f to force) |
|
306 | 304 | [255] |
|
307 | 305 | $ hg tags |
|
308 | 306 | tip 6:735c3ca72986 |
|
309 | 307 | bar 0:bbd179dfa0a7 |
|
310 | 308 | |
|
311 | 309 | Strip 1: expose an old head: |
|
312 | 310 | |
|
313 | 311 | $ hg --config extensions.mq= strip 5 |
|
314 | 312 | saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
|
315 | 313 | $ hg tags # partly stale cache |
|
316 | 314 | tip 5:735c3ca72986 |
|
317 | 315 | bar 1:78391a272241 |
|
318 | 316 | $ hg tags # up-to-date cache |
|
319 | 317 | tip 5:735c3ca72986 |
|
320 | 318 | bar 1:78391a272241 |
|
321 | 319 | |
|
322 | 320 | Strip 2: destroy whole branch, no old head exposed |
|
323 | 321 | |
|
324 | 322 | $ hg --config extensions.mq= strip 4 |
|
325 | 323 | saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob) |
|
326 | 324 | $ hg tags # partly stale |
|
327 | 325 | tip 4:735c3ca72986 |
|
328 | 326 | bar 0:bbd179dfa0a7 |
|
329 | 327 | $ rm -f .hg/cache/tags |
|
330 | 328 | $ hg tags # cold cache |
|
331 | 329 | tip 4:735c3ca72986 |
|
332 | 330 | bar 0:bbd179dfa0a7 |
|
333 | 331 | |
|
334 | 332 | Test tag rank with 3 heads: |
|
335 | 333 | |
|
336 | 334 | $ cd .. |
|
337 | 335 | $ hg init t4 |
|
338 | 336 | $ cd t4 |
|
339 | 337 | $ echo foo > foo |
|
340 | 338 | $ hg add |
|
341 | 339 | adding foo |
|
342 | 340 | $ hg ci -m 'add foo' # rev 0 |
|
343 | 341 | $ hg tag bar # rev 1 bar -> 0 |
|
344 | 342 | $ hg tag -f bar # rev 2 bar -> 1 |
|
345 | 343 | $ hg up -qC 0 |
|
346 | 344 | $ hg tag -fr 2 bar # rev 3 bar -> 2 |
|
347 | 345 | $ hg tags |
|
348 | 346 | tip 3:197c21bbbf2c |
|
349 | 347 | bar 2:6fa450212aeb |
|
350 | 348 | $ hg up -qC 0 |
|
351 | 349 | $ hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 |
|
352 | 350 | |
|
353 | 351 | Bar should still point to rev 2: |
|
354 | 352 | |
|
355 | 353 | $ hg tags |
|
356 | 354 | tip 4:3b4b14ed0202 |
|
357 | 355 | bar 2:6fa450212aeb |
|
358 | 356 | |
|
359 | 357 | Test that removing global/local tags does not get confused when trying |
|
360 | 358 | to remove a tag of type X which actually only exists as a type Y: |
|
361 | 359 | |
|
362 | 360 | $ cd .. |
|
363 | 361 | $ hg init t5 |
|
364 | 362 | $ cd t5 |
|
365 | 363 | $ echo foo > foo |
|
366 | 364 | $ hg add |
|
367 | 365 | adding foo |
|
368 | 366 | $ hg ci -m 'add foo' # rev 0 |
|
369 | 367 | |
|
370 | 368 | $ hg tag -r 0 -l localtag |
|
371 | 369 | $ hg tag --remove localtag |
|
372 | 370 | abort: tag 'localtag' is not a global tag |
|
373 | 371 | [255] |
|
374 | 372 | $ |
|
375 | 373 | $ hg tag -r 0 globaltag |
|
376 | 374 | $ hg tag --remove -l globaltag |
|
377 | 375 | abort: tag 'globaltag' is not a local tag |
|
378 | 376 | [255] |
|
379 | 377 | $ hg tags -v |
|
380 | 378 | tip 1:a0b6fe111088 |
|
381 | 379 | localtag 0:bbd179dfa0a7 local |
|
382 | 380 | globaltag 0:bbd179dfa0a7 |
@@ -1,446 +1,424 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ hg init t |
|
3 | 3 | $ cd t |
|
4 | 4 | $ cat > unix2dos.py <<EOF |
|
5 | 5 | > import sys |
|
6 | 6 | > |
|
7 | 7 | > for path in sys.argv[1:]: |
|
8 | 8 | > data = file(path, 'rb').read() |
|
9 | 9 | > data = data.replace('\n', '\r\n') |
|
10 | 10 | > file(path, 'wb').write(data) |
|
11 | 11 | > EOF |
|
12 | 12 | $ echo '[hooks]' >> .hg/hgrc |
|
13 | 13 | $ echo 'pretxncommit.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
|
14 | 14 | $ echo 'pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf' >> .hg/hgrc |
|
15 | 15 | $ cat .hg/hgrc |
|
16 | 16 | [hooks] |
|
17 | 17 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf |
|
18 | 18 | pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf |
|
19 | $ echo | |
|
20 | ||
|
19 | ||
|
21 | 20 | $ echo hello > f |
|
22 | 21 | $ hg add f |
|
23 | 22 | |
|
24 | 23 | commit should succeed |
|
25 | 24 | |
|
26 | 25 | $ hg ci -m 1 |
|
27 | $ echo | |
|
28 | ||
|
26 | ||
|
29 | 27 | $ hg clone . ../zoz |
|
30 | 28 | updating to branch default |
|
31 | 29 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
32 | 30 | $ cp .hg/hgrc ../zoz/.hg |
|
33 | 31 | $ python unix2dos.py f |
|
34 | 32 | |
|
35 | 33 | commit should fail |
|
36 | 34 | |
|
37 | 35 | $ hg ci -m 2.1 |
|
38 | 36 | Attempt to commit or push text file(s) using CRLF line endings |
|
39 | 37 | in f583ea08d42a: f |
|
40 | 38 | transaction abort! |
|
41 | 39 | rollback completed |
|
42 | 40 | abort: pretxncommit.crlf hook failed |
|
43 | 41 | [255] |
|
44 | $ echo | |
|
45 | ||
|
42 | ||
|
46 | 43 | $ mv .hg/hgrc .hg/hgrc.bak |
|
47 | 44 | |
|
48 | 45 | commits should succeed |
|
49 | 46 | |
|
50 | 47 | $ hg ci -m 2 |
|
51 | 48 | $ hg cp f g |
|
52 | 49 | $ hg ci -m 2.2 |
|
53 | $ echo | |
|
54 | ||
|
55 | 50 | |
|
56 | 51 | push should fail |
|
57 | 52 | |
|
58 | 53 | $ hg push ../zoz |
|
59 | 54 | pushing to ../zoz |
|
60 | 55 | searching for changes |
|
61 | 56 | adding changesets |
|
62 | 57 | adding manifests |
|
63 | 58 | adding file changes |
|
64 | 59 | added 2 changesets with 2 changes to 2 files |
|
65 | 60 | Attempt to commit or push text file(s) using CRLF line endings |
|
66 | 61 | in bc2d09796734: g |
|
67 | 62 | in b1aa5cde7ff4: f |
|
68 | 63 | |
|
69 | 64 | To prevent this mistake in your local repository, |
|
70 | 65 | add to Mercurial.ini or .hg/hgrc: |
|
71 | 66 | |
|
72 | 67 | [hooks] |
|
73 | 68 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf |
|
74 | 69 | |
|
75 | 70 | and also consider adding: |
|
76 | 71 | |
|
77 | 72 | [extensions] |
|
78 | 73 | win32text = |
|
79 | 74 | [encode] |
|
80 | 75 | ** = cleverencode: |
|
81 | 76 | [decode] |
|
82 | 77 | ** = cleverdecode: |
|
83 | 78 | transaction abort! |
|
84 | 79 | rollback completed |
|
85 | 80 | abort: pretxnchangegroup.crlf hook failed |
|
86 | 81 | [255] |
|
87 | $ echo | |
|
88 | ||
|
82 | ||
|
89 | 83 | $ mv .hg/hgrc.bak .hg/hgrc |
|
90 | 84 | $ echo hello > f |
|
91 | 85 | $ hg rm g |
|
92 | 86 | |
|
93 | 87 | commit should succeed |
|
94 | 88 | |
|
95 | 89 | $ hg ci -m 2.3 |
|
96 | $ echo | |
|
97 | ||
|
98 | 90 | |
|
99 | 91 | push should succeed |
|
100 | 92 | |
|
101 | 93 | $ hg push ../zoz |
|
102 | 94 | pushing to ../zoz |
|
103 | 95 | searching for changes |
|
104 | 96 | adding changesets |
|
105 | 97 | adding manifests |
|
106 | 98 | adding file changes |
|
107 | 99 | added 3 changesets with 3 changes to 2 files |
|
108 | $ echo | |
|
109 | ||
|
110 | 100 | |
|
111 | 101 | and now for something completely different |
|
112 | 102 | |
|
113 | 103 | $ mkdir d |
|
114 | 104 | $ echo hello > d/f2 |
|
115 | 105 | $ python unix2dos.py d/f2 |
|
116 | 106 | $ hg add d/f2 |
|
117 | 107 | $ hg ci -m 3 |
|
118 | 108 | Attempt to commit or push text file(s) using CRLF line endings |
|
119 | 109 | in 053ba1a3035a: d/f2 |
|
120 | 110 | transaction abort! |
|
121 | 111 | rollback completed |
|
122 | 112 | abort: pretxncommit.crlf hook failed |
|
123 | 113 | [255] |
|
124 | 114 | $ hg revert -a |
|
125 | 115 | forgetting d/f2 |
|
126 | 116 | $ rm d/f2 |
|
127 | $ echo | |
|
128 | ||
|
117 | ||
|
129 | 118 | $ hg rem f |
|
130 | 119 | $ hg ci -m 4 |
|
131 | $ echo | |
|
132 | ||
|
120 | ||
|
133 | 121 | $ python -c 'file("bin", "wb").write("hello\x00\x0D\x0A")' |
|
134 | 122 | $ hg add bin |
|
135 | 123 | $ hg ci -m 5 |
|
136 | 124 | $ hg log -v |
|
137 | 125 | changeset: 5:f0b1c8d75fce |
|
138 | 126 | tag: tip |
|
139 | 127 | user: test |
|
140 | 128 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
141 | 129 | files: bin |
|
142 | 130 | description: |
|
143 | 131 | 5 |
|
144 | 132 | |
|
145 | 133 | |
|
146 | 134 | changeset: 4:77796dbcd4ad |
|
147 | 135 | user: test |
|
148 | 136 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
149 | 137 | files: f |
|
150 | 138 | description: |
|
151 | 139 | 4 |
|
152 | 140 | |
|
153 | 141 | |
|
154 | 142 | changeset: 3:7c1b5430b350 |
|
155 | 143 | user: test |
|
156 | 144 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
157 | 145 | files: f g |
|
158 | 146 | description: |
|
159 | 147 | 2.3 |
|
160 | 148 | |
|
161 | 149 | |
|
162 | 150 | changeset: 2:bc2d09796734 |
|
163 | 151 | user: test |
|
164 | 152 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
165 | 153 | files: g |
|
166 | 154 | description: |
|
167 | 155 | 2.2 |
|
168 | 156 | |
|
169 | 157 | |
|
170 | 158 | changeset: 1:b1aa5cde7ff4 |
|
171 | 159 | user: test |
|
172 | 160 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
173 | 161 | files: f |
|
174 | 162 | description: |
|
175 | 163 | 2 |
|
176 | 164 | |
|
177 | 165 | |
|
178 | 166 | changeset: 0:fcf06d5c4e1d |
|
179 | 167 | user: test |
|
180 | 168 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
181 | 169 | files: f |
|
182 | 170 | description: |
|
183 | 171 | 1 |
|
184 | 172 | |
|
185 | 173 | |
|
186 | $ echo | |
|
187 | ||
|
188 | 174 | $ hg clone . dupe |
|
189 | 175 | updating to branch default |
|
190 | 176 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
191 | $ echo | |
|
192 | ||
|
177 | ||
|
193 | 178 | $ for x in a b c d; do echo content > dupe/$x; done |
|
194 | 179 | $ hg -R dupe add |
|
195 | 180 | adding dupe/a |
|
196 | 181 | adding dupe/b |
|
197 | 182 | adding dupe/c |
|
198 | 183 | adding dupe/d |
|
199 | 184 | $ python unix2dos.py dupe/b dupe/c dupe/d |
|
200 | 185 | $ hg -R dupe ci -m a dupe/a |
|
201 | 186 | $ hg -R dupe ci -m b/c dupe/[bc] |
|
202 | 187 | $ hg -R dupe ci -m d dupe/d |
|
203 | 188 | $ hg -R dupe log -v |
|
204 | 189 | changeset: 8:67ac5962ab43 |
|
205 | 190 | tag: tip |
|
206 | 191 | user: test |
|
207 | 192 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
208 | 193 | files: d |
|
209 | 194 | description: |
|
210 | 195 | d |
|
211 | 196 | |
|
212 | 197 | |
|
213 | 198 | changeset: 7:68c127d1834e |
|
214 | 199 | user: test |
|
215 | 200 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
216 | 201 | files: b c |
|
217 | 202 | description: |
|
218 | 203 | b/c |
|
219 | 204 | |
|
220 | 205 | |
|
221 | 206 | changeset: 6:adbf8bf7f31d |
|
222 | 207 | user: test |
|
223 | 208 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
224 | 209 | files: a |
|
225 | 210 | description: |
|
226 | 211 | a |
|
227 | 212 | |
|
228 | 213 | |
|
229 | 214 | changeset: 5:f0b1c8d75fce |
|
230 | 215 | user: test |
|
231 | 216 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
232 | 217 | files: bin |
|
233 | 218 | description: |
|
234 | 219 | 5 |
|
235 | 220 | |
|
236 | 221 | |
|
237 | 222 | changeset: 4:77796dbcd4ad |
|
238 | 223 | user: test |
|
239 | 224 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
240 | 225 | files: f |
|
241 | 226 | description: |
|
242 | 227 | 4 |
|
243 | 228 | |
|
244 | 229 | |
|
245 | 230 | changeset: 3:7c1b5430b350 |
|
246 | 231 | user: test |
|
247 | 232 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
248 | 233 | files: f g |
|
249 | 234 | description: |
|
250 | 235 | 2.3 |
|
251 | 236 | |
|
252 | 237 | |
|
253 | 238 | changeset: 2:bc2d09796734 |
|
254 | 239 | user: test |
|
255 | 240 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
256 | 241 | files: g |
|
257 | 242 | description: |
|
258 | 243 | 2.2 |
|
259 | 244 | |
|
260 | 245 | |
|
261 | 246 | changeset: 1:b1aa5cde7ff4 |
|
262 | 247 | user: test |
|
263 | 248 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
264 | 249 | files: f |
|
265 | 250 | description: |
|
266 | 251 | 2 |
|
267 | 252 | |
|
268 | 253 | |
|
269 | 254 | changeset: 0:fcf06d5c4e1d |
|
270 | 255 | user: test |
|
271 | 256 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
272 | 257 | files: f |
|
273 | 258 | description: |
|
274 | 259 | 1 |
|
275 | 260 | |
|
276 | 261 | |
|
277 | $ echo | |
|
278 | ||
|
279 | 262 | $ hg pull dupe |
|
280 | 263 | pulling from dupe |
|
281 | 264 | searching for changes |
|
282 | 265 | adding changesets |
|
283 | 266 | adding manifests |
|
284 | 267 | adding file changes |
|
285 | 268 | added 3 changesets with 4 changes to 4 files |
|
286 | 269 | Attempt to commit or push text file(s) using CRLF line endings |
|
287 | 270 | in 67ac5962ab43: d |
|
288 | 271 | in 68c127d1834e: b |
|
289 | 272 | in 68c127d1834e: c |
|
290 | 273 | |
|
291 | 274 | To prevent this mistake in your local repository, |
|
292 | 275 | add to Mercurial.ini or .hg/hgrc: |
|
293 | 276 | |
|
294 | 277 | [hooks] |
|
295 | 278 | pretxncommit.crlf = python:hgext.win32text.forbidcrlf |
|
296 | 279 | |
|
297 | 280 | and also consider adding: |
|
298 | 281 | |
|
299 | 282 | [extensions] |
|
300 | 283 | win32text = |
|
301 | 284 | [encode] |
|
302 | 285 | ** = cleverencode: |
|
303 | 286 | [decode] |
|
304 | 287 | ** = cleverdecode: |
|
305 | 288 | transaction abort! |
|
306 | 289 | rollback completed |
|
307 | 290 | abort: pretxnchangegroup.crlf hook failed |
|
308 | 291 | [255] |
|
309 | $ echo | |
|
310 | ||
|
292 | ||
|
311 | 293 | $ hg log -v |
|
312 | 294 | changeset: 5:f0b1c8d75fce |
|
313 | 295 | tag: tip |
|
314 | 296 | user: test |
|
315 | 297 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
316 | 298 | files: bin |
|
317 | 299 | description: |
|
318 | 300 | 5 |
|
319 | 301 | |
|
320 | 302 | |
|
321 | 303 | changeset: 4:77796dbcd4ad |
|
322 | 304 | user: test |
|
323 | 305 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
324 | 306 | files: f |
|
325 | 307 | description: |
|
326 | 308 | 4 |
|
327 | 309 | |
|
328 | 310 | |
|
329 | 311 | changeset: 3:7c1b5430b350 |
|
330 | 312 | user: test |
|
331 | 313 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
332 | 314 | files: f g |
|
333 | 315 | description: |
|
334 | 316 | 2.3 |
|
335 | 317 | |
|
336 | 318 | |
|
337 | 319 | changeset: 2:bc2d09796734 |
|
338 | 320 | user: test |
|
339 | 321 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
340 | 322 | files: g |
|
341 | 323 | description: |
|
342 | 324 | 2.2 |
|
343 | 325 | |
|
344 | 326 | |
|
345 | 327 | changeset: 1:b1aa5cde7ff4 |
|
346 | 328 | user: test |
|
347 | 329 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
348 | 330 | files: f |
|
349 | 331 | description: |
|
350 | 332 | 2 |
|
351 | 333 | |
|
352 | 334 | |
|
353 | 335 | changeset: 0:fcf06d5c4e1d |
|
354 | 336 | user: test |
|
355 | 337 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
356 | 338 | files: f |
|
357 | 339 | description: |
|
358 | 340 | 1 |
|
359 | 341 | |
|
360 | 342 | |
|
361 | $ echo | |
|
362 | ||
|
363 | 343 | $ rm .hg/hgrc |
|
364 | 344 | $ (echo some; echo text) > f3 |
|
365 | 345 | $ python -c 'file("f4.bat", "wb").write("rem empty\x0D\x0A")' |
|
366 | 346 | $ hg add f3 f4.bat |
|
367 | 347 | $ hg ci -m 6 |
|
368 | 348 | $ cat bin |
|
369 | 349 | hello\x00\r (esc) |
|
370 | 350 | $ cat f3 |
|
371 | 351 | some |
|
372 | 352 | text |
|
373 | 353 | $ cat f4.bat |
|
374 | 354 | rem empty\r (esc) |
|
375 | $ echo | |
|
376 | ||
|
355 | ||
|
377 | 356 | $ echo '[extensions]' >> .hg/hgrc |
|
378 | 357 | $ echo 'win32text = ' >> .hg/hgrc |
|
379 | 358 | $ echo '[decode]' >> .hg/hgrc |
|
380 | 359 | $ echo '** = cleverdecode:' >> .hg/hgrc |
|
381 | 360 | $ echo '[encode]' >> .hg/hgrc |
|
382 | 361 | $ echo '** = cleverencode:' >> .hg/hgrc |
|
383 | 362 | $ cat .hg/hgrc |
|
384 | 363 | [extensions] |
|
385 | 364 | win32text = |
|
386 | 365 | [decode] |
|
387 | 366 | ** = cleverdecode: |
|
388 | 367 | [encode] |
|
389 | 368 | ** = cleverencode: |
|
390 | 369 | |
|
391 | 370 | Trigger deprecation warning: |
|
392 | 371 | |
|
393 | 372 | $ hg id -t |
|
394 | 373 | win32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension |
|
395 | 374 | tip |
|
396 | 375 | |
|
397 | 376 | Disable warning: |
|
398 | 377 | |
|
399 | 378 | $ echo '[win32text]' >> .hg/hgrc |
|
400 | 379 | $ echo 'warn = no' >> .hg/hgrc |
|
401 | 380 | $ hg id -t |
|
402 | 381 | tip |
|
403 | 382 | |
|
404 | 383 | $ rm f3 f4.bat bin |
|
405 | 384 | $ hg co -C |
|
406 | 385 | WARNING: f4.bat already has CRLF line endings |
|
407 | 386 | and does not need EOL conversion by the win32text plugin. |
|
408 | 387 | Before your next commit, please reconsider your encode/decode settings in |
|
409 | 388 | Mercurial.ini or $TESTTMP/t/.hg/hgrc. |
|
410 | 389 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
411 | 390 | $ cat bin |
|
412 | 391 | hello\x00\r (esc) |
|
413 | 392 | $ cat f3 |
|
414 | 393 | some\r (esc) |
|
415 | 394 | text\r (esc) |
|
416 | 395 | $ cat f4.bat |
|
417 | 396 | rem empty\r (esc) |
|
418 | $ echo | |
|
419 | ||
|
397 | ||
|
420 | 398 | $ python -c 'file("f5.sh", "wb").write("# empty\x0D\x0A")' |
|
421 | 399 | $ hg add f5.sh |
|
422 | 400 | $ hg ci -m 7 |
|
423 | 401 | $ cat f5.sh |
|
424 | 402 | # empty\r (esc) |
|
425 | 403 | $ hg cat f5.sh |
|
426 | 404 | # empty |
|
427 | 405 | $ echo '% just linefeed' > linefeed |
|
428 | 406 | $ hg ci -qAm 8 linefeed |
|
429 | 407 | $ cat linefeed |
|
430 | 408 | % just linefeed |
|
431 | 409 | $ hg cat linefeed |
|
432 | 410 | % just linefeed |
|
433 | 411 | $ hg st -q |
|
434 | 412 | $ hg revert -a linefeed |
|
435 | 413 | no changes needed to linefeed |
|
436 | 414 | $ cat linefeed |
|
437 | 415 | % just linefeed |
|
438 | 416 | $ hg st -q |
|
439 | 417 | $ echo modified >> linefeed |
|
440 | 418 | $ hg st -q |
|
441 | 419 | M linefeed |
|
442 | 420 | $ hg revert -a |
|
443 | 421 | reverting linefeed |
|
444 | 422 | $ hg st -q |
|
445 | 423 | $ cat linefeed |
|
446 | 424 | % just linefeed\r (esc) |
General Comments 0
You need to be logged in to leave comments.
Login now