##// END OF EJS Templates
py3: fix .write() calls in few tests...
Pulkit Goyal -
r38097:b95a6fb7 default
parent child Browse files
Show More
@@ -1,426 +1,426 b''
1 #require tic
1 #require tic
2
2
3 Set up a repo
3 Set up a repo
4
4
5 $ cp $HGRCPATH $HGRCPATH.pretest
5 $ cp $HGRCPATH $HGRCPATH.pretest
6 $ cat <<EOF >> $HGRCPATH
6 $ cat <<EOF >> $HGRCPATH
7 > [ui]
7 > [ui]
8 > interactive = true
8 > interactive = true
9 > interface = curses
9 > interface = curses
10 > [experimental]
10 > [experimental]
11 > crecordtest = testModeCommands
11 > crecordtest = testModeCommands
12 > EOF
12 > EOF
13
13
14 Record with noeol at eof (issue5268)
14 Record with noeol at eof (issue5268)
15 $ hg init noeol
15 $ hg init noeol
16 $ cd noeol
16 $ cd noeol
17 $ printf '0' > a
17 $ printf '0' > a
18 $ printf '0\n' > b
18 $ printf '0\n' > b
19 $ hg ci -Aqm initial
19 $ hg ci -Aqm initial
20 $ printf '1\n0' > a
20 $ printf '1\n0' > a
21 $ printf '1\n0\n' > b
21 $ printf '1\n0\n' > b
22 $ cat <<EOF >testModeCommands
22 $ cat <<EOF >testModeCommands
23 > c
23 > c
24 > EOF
24 > EOF
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
25 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "add hunks" -d "0 0"
26 $ cd ..
26 $ cd ..
27
27
28 Normal repo
28 Normal repo
29 $ hg init a
29 $ hg init a
30 $ cd a
30 $ cd a
31
31
32 Committing some changes but stopping on the way
32 Committing some changes but stopping on the way
33
33
34 $ echo "a" > a
34 $ echo "a" > a
35 $ hg add a
35 $ hg add a
36 $ cat <<EOF >testModeCommands
36 $ cat <<EOF >testModeCommands
37 > TOGGLE
37 > TOGGLE
38 > X
38 > X
39 > EOF
39 > EOF
40 $ hg commit -i -m "a" -d "0 0"
40 $ hg commit -i -m "a" -d "0 0"
41 no changes to record
41 no changes to record
42 [1]
42 [1]
43 $ hg tip
43 $ hg tip
44 changeset: -1:000000000000
44 changeset: -1:000000000000
45 tag: tip
45 tag: tip
46 user:
46 user:
47 date: Thu Jan 01 00:00:00 1970 +0000
47 date: Thu Jan 01 00:00:00 1970 +0000
48
48
49
49
50 Committing some changes
50 Committing some changes
51
51
52 $ cat <<EOF >testModeCommands
52 $ cat <<EOF >testModeCommands
53 > X
53 > X
54 > EOF
54 > EOF
55 $ hg commit -i -m "a" -d "0 0"
55 $ hg commit -i -m "a" -d "0 0"
56 $ hg tip
56 $ hg tip
57 changeset: 0:cb9a9f314b8b
57 changeset: 0:cb9a9f314b8b
58 tag: tip
58 tag: tip
59 user: test
59 user: test
60 date: Thu Jan 01 00:00:00 1970 +0000
60 date: Thu Jan 01 00:00:00 1970 +0000
61 summary: a
61 summary: a
62
62
63 Check that commit -i works with no changes
63 Check that commit -i works with no changes
64 $ hg commit -i
64 $ hg commit -i
65 no changes to record
65 no changes to record
66 [1]
66 [1]
67
67
68 Committing only one file
68 Committing only one file
69
69
70 $ echo "a" >> a
70 $ echo "a" >> a
71 >>> open('b', 'wb').write("1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n")
71 >>> open('b', 'wb').write(b"1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n") and None
72 $ hg add b
72 $ hg add b
73 $ cat <<EOF >testModeCommands
73 $ cat <<EOF >testModeCommands
74 > TOGGLE
74 > TOGGLE
75 > KEY_DOWN
75 > KEY_DOWN
76 > X
76 > X
77 > EOF
77 > EOF
78 $ hg commit -i -m "one file" -d "0 0"
78 $ hg commit -i -m "one file" -d "0 0"
79 $ hg tip
79 $ hg tip
80 changeset: 1:fb2705a663ea
80 changeset: 1:fb2705a663ea
81 tag: tip
81 tag: tip
82 user: test
82 user: test
83 date: Thu Jan 01 00:00:00 1970 +0000
83 date: Thu Jan 01 00:00:00 1970 +0000
84 summary: one file
84 summary: one file
85
85
86 $ hg cat -r tip a
86 $ hg cat -r tip a
87 a
87 a
88 $ cat a
88 $ cat a
89 a
89 a
90 a
90 a
91
91
92 Committing only one hunk while aborting edition of hunk
92 Committing only one hunk while aborting edition of hunk
93
93
94 - Untoggle all the hunks, go down to the second file
94 - Untoggle all the hunks, go down to the second file
95 - unfold it
95 - unfold it
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
96 - go down to second hunk (1 for the first hunk, 1 for the first hunkline, 1 for the second hunk, 1 for the second hunklike)
97 - toggle the second hunk
97 - toggle the second hunk
98 - toggle on and off the amend mode (to check that it toggles off)
98 - toggle on and off the amend mode (to check that it toggles off)
99 - edit the hunk and quit the editor immediately with non-zero status
99 - edit the hunk and quit the editor immediately with non-zero status
100 - commit
100 - commit
101
101
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
102 $ printf "printf 'editor ran\n'; exit 1" > editor.sh
103 $ echo "x" > c
103 $ echo "x" > c
104 $ cat b >> c
104 $ cat b >> c
105 $ echo "y" >> c
105 $ echo "y" >> c
106 $ mv c b
106 $ mv c b
107 $ cat <<EOF >testModeCommands
107 $ cat <<EOF >testModeCommands
108 > A
108 > A
109 > KEY_DOWN
109 > KEY_DOWN
110 > f
110 > f
111 > KEY_DOWN
111 > KEY_DOWN
112 > KEY_DOWN
112 > KEY_DOWN
113 > KEY_DOWN
113 > KEY_DOWN
114 > KEY_DOWN
114 > KEY_DOWN
115 > TOGGLE
115 > TOGGLE
116 > a
116 > a
117 > a
117 > a
118 > e
118 > e
119 > X
119 > X
120 > EOF
120 > EOF
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
121 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "one hunk" -d "0 0"
122 editor ran
122 editor ran
123 $ rm editor.sh
123 $ rm editor.sh
124 $ hg tip
124 $ hg tip
125 changeset: 2:7d10dfe755a8
125 changeset: 2:7d10dfe755a8
126 tag: tip
126 tag: tip
127 user: test
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: one hunk
129 summary: one hunk
130
130
131 $ hg cat -r tip b
131 $ hg cat -r tip b
132 1
132 1
133 2
133 2
134 3
134 3
135 4
135 4
136 5
136 5
137 6
137 6
138 7
138 7
139 8
139 8
140 9
140 9
141 10
141 10
142 y
142 y
143 $ cat b
143 $ cat b
144 x
144 x
145 1
145 1
146 2
146 2
147 3
147 3
148 4
148 4
149 5
149 5
150 6
150 6
151 7
151 7
152 8
152 8
153 9
153 9
154 10
154 10
155 y
155 y
156 $ hg commit -m "other hunks"
156 $ hg commit -m "other hunks"
157 $ hg tip
157 $ hg tip
158 changeset: 3:a6735021574d
158 changeset: 3:a6735021574d
159 tag: tip
159 tag: tip
160 user: test
160 user: test
161 date: Thu Jan 01 00:00:00 1970 +0000
161 date: Thu Jan 01 00:00:00 1970 +0000
162 summary: other hunks
162 summary: other hunks
163
163
164 $ hg cat -r tip b
164 $ hg cat -r tip b
165 x
165 x
166 1
166 1
167 2
167 2
168 3
168 3
169 4
169 4
170 5
170 5
171 6
171 6
172 7
172 7
173 8
173 8
174 9
174 9
175 10
175 10
176 y
176 y
177
177
178 Newly added files can be selected with the curses interface
178 Newly added files can be selected with the curses interface
179
179
180 $ hg update -C .
180 $ hg update -C .
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
181 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 $ echo "hello" > x
182 $ echo "hello" > x
183 $ hg add x
183 $ hg add x
184 $ cat <<EOF >testModeCommands
184 $ cat <<EOF >testModeCommands
185 > TOGGLE
185 > TOGGLE
186 > TOGGLE
186 > TOGGLE
187 > X
187 > X
188 > EOF
188 > EOF
189 $ hg st
189 $ hg st
190 A x
190 A x
191 ? testModeCommands
191 ? testModeCommands
192 $ hg commit -i -m "newly added file" -d "0 0"
192 $ hg commit -i -m "newly added file" -d "0 0"
193 $ hg st
193 $ hg st
194 ? testModeCommands
194 ? testModeCommands
195
195
196 Amend option works
196 Amend option works
197 $ echo "hello world" > x
197 $ echo "hello world" > x
198 $ hg diff -c .
198 $ hg diff -c .
199 diff -r a6735021574d -r 2b0e9be4d336 x
199 diff -r a6735021574d -r 2b0e9be4d336 x
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
200 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
201 +++ b/x Thu Jan 01 00:00:00 1970 +0000
202 @@ -0,0 +1,1 @@
202 @@ -0,0 +1,1 @@
203 +hello
203 +hello
204 $ cat <<EOF >testModeCommands
204 $ cat <<EOF >testModeCommands
205 > a
205 > a
206 > X
206 > X
207 > EOF
207 > EOF
208 $ hg commit -i -m "newly added file" -d "0 0"
208 $ hg commit -i -m "newly added file" -d "0 0"
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg
209 saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-3cf0bc8c-amend.hg
210 $ hg diff -c .
210 $ hg diff -c .
211 diff -r a6735021574d -r c1d239d165ae x
211 diff -r a6735021574d -r c1d239d165ae x
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
212 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
213 +++ b/x Thu Jan 01 00:00:00 1970 +0000
214 @@ -0,0 +1,1 @@
214 @@ -0,0 +1,1 @@
215 +hello world
215 +hello world
216
216
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
217 Editing a hunk puts you back on that hunk when done editing (issue5041)
218 To do that, we change two lines in a file, pretend to edit the second line,
218 To do that, we change two lines in a file, pretend to edit the second line,
219 exit, toggle the line selected at the end of the edit and commit.
219 exit, toggle the line selected at the end of the edit and commit.
220 The first line should be recorded if we were put on the second line at the end
220 The first line should be recorded if we were put on the second line at the end
221 of the edit.
221 of the edit.
222
222
223 $ hg update -C .
223 $ hg update -C .
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
224 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
225 $ echo "foo" > x
225 $ echo "foo" > x
226 $ echo "hello world" >> x
226 $ echo "hello world" >> x
227 $ echo "bar" >> x
227 $ echo "bar" >> x
228 $ cat <<EOF >testModeCommands
228 $ cat <<EOF >testModeCommands
229 > f
229 > f
230 > KEY_DOWN
230 > KEY_DOWN
231 > KEY_DOWN
231 > KEY_DOWN
232 > KEY_DOWN
232 > KEY_DOWN
233 > KEY_DOWN
233 > KEY_DOWN
234 > e
234 > e
235 > TOGGLE
235 > TOGGLE
236 > X
236 > X
237 > EOF
237 > EOF
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
238 $ printf "printf 'editor ran\n'; exit 0" > editor.sh
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
239 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "edit hunk" -d "0 0"
240 editor ran
240 editor ran
241 $ hg cat -r . x
241 $ hg cat -r . x
242 foo
242 foo
243 hello world
243 hello world
244
244
245 Testing the review option. The entire final filtered patch should show
245 Testing the review option. The entire final filtered patch should show
246 up in the editor and be editable. We will unselect the second file and
246 up in the editor and be editable. We will unselect the second file and
247 the first hunk of the third file. During review, we will decide that
247 the first hunk of the third file. During review, we will decide that
248 "lower" sounds better than "bottom", and the final commit should
248 "lower" sounds better than "bottom", and the final commit should
249 reflect this edition.
249 reflect this edition.
250
250
251 $ hg update -C .
251 $ hg update -C .
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
253 $ echo "top" > c
253 $ echo "top" > c
254 $ cat x >> c
254 $ cat x >> c
255 $ echo "bottom" >> c
255 $ echo "bottom" >> c
256 $ mv c x
256 $ mv c x
257 $ echo "third a" >> a
257 $ echo "third a" >> a
258 $ echo "we will unselect this" >> b
258 $ echo "we will unselect this" >> b
259
259
260 $ cat > editor.sh <<EOF
260 $ cat > editor.sh <<EOF
261 > cat "\$1"
261 > cat "\$1"
262 > cat "\$1" | sed s/bottom/lower/ > tmp
262 > cat "\$1" | sed s/bottom/lower/ > tmp
263 > mv tmp "\$1"
263 > mv tmp "\$1"
264 > EOF
264 > EOF
265 $ cat > testModeCommands <<EOF
265 $ cat > testModeCommands <<EOF
266 > KEY_DOWN
266 > KEY_DOWN
267 > TOGGLE
267 > TOGGLE
268 > KEY_DOWN
268 > KEY_DOWN
269 > f
269 > f
270 > KEY_DOWN
270 > KEY_DOWN
271 > TOGGLE
271 > TOGGLE
272 > R
272 > R
273 > EOF
273 > EOF
274
274
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
275 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -m "review hunks" -d "0 0"
276 # To remove '-' lines, make them ' ' lines (context).
276 # To remove '-' lines, make them ' ' lines (context).
277 # To remove '+' lines, delete them.
277 # To remove '+' lines, delete them.
278 # Lines starting with # will be removed from the patch.
278 # Lines starting with # will be removed from the patch.
279 #
279 #
280 # If the patch applies cleanly, the edited patch will immediately
280 # If the patch applies cleanly, the edited patch will immediately
281 # be finalised. If it does not apply cleanly, rejects files will be
281 # be finalised. If it does not apply cleanly, rejects files will be
282 # generated. You can use those when you try again.
282 # generated. You can use those when you try again.
283 diff --git a/a b/a
283 diff --git a/a b/a
284 --- a/a
284 --- a/a
285 +++ b/a
285 +++ b/a
286 @@ -1,2 +1,3 @@
286 @@ -1,2 +1,3 @@
287 a
287 a
288 a
288 a
289 +third a
289 +third a
290 diff --git a/x b/x
290 diff --git a/x b/x
291 --- a/x
291 --- a/x
292 +++ b/x
292 +++ b/x
293 @@ -1,2 +1,3 @@
293 @@ -1,2 +1,3 @@
294 foo
294 foo
295 hello world
295 hello world
296 +bottom
296 +bottom
297
297
298 $ hg cat -r . a
298 $ hg cat -r . a
299 a
299 a
300 a
300 a
301 third a
301 third a
302
302
303 $ hg cat -r . b
303 $ hg cat -r . b
304 x
304 x
305 1
305 1
306 2
306 2
307 3
307 3
308 4
308 4
309 5
309 5
310 6
310 6
311 7
311 7
312 8
312 8
313 9
313 9
314 10
314 10
315 y
315 y
316
316
317 $ hg cat -r . x
317 $ hg cat -r . x
318 foo
318 foo
319 hello world
319 hello world
320 lower
320 lower
321
321
322 Check spacemovesdown
322 Check spacemovesdown
323
323
324 $ cat <<EOF >> $HGRCPATH
324 $ cat <<EOF >> $HGRCPATH
325 > [experimental]
325 > [experimental]
326 > spacemovesdown = true
326 > spacemovesdown = true
327 > EOF
327 > EOF
328 $ cat <<EOF >testModeCommands
328 $ cat <<EOF >testModeCommands
329 > TOGGLE
329 > TOGGLE
330 > TOGGLE
330 > TOGGLE
331 > X
331 > X
332 > EOF
332 > EOF
333 $ hg status -q
333 $ hg status -q
334 M b
334 M b
335 M x
335 M x
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
336 $ hg commit -i -m "nothing to commit?" -d "0 0"
337 no changes to record
337 no changes to record
338 [1]
338 [1]
339
339
340 Check ui.interface logic for the chunkselector
340 Check ui.interface logic for the chunkselector
341
341
342 The default interface is text
342 The default interface is text
343 $ cp $HGRCPATH.pretest $HGRCPATH
343 $ cp $HGRCPATH.pretest $HGRCPATH
344 $ chunkselectorinterface() {
344 $ chunkselectorinterface() {
345 > $PYTHON <<EOF
345 > $PYTHON <<EOF
346 > from mercurial import hg, ui;\
346 > from mercurial import hg, ui;\
347 > repo = hg.repository(ui.ui.load(), ".");\
347 > repo = hg.repository(ui.ui.load(), ".");\
348 > print(repo.ui.interface("chunkselector"))
348 > print(repo.ui.interface("chunkselector"))
349 > EOF
349 > EOF
350 > }
350 > }
351 $ chunkselectorinterface
351 $ chunkselectorinterface
352 text
352 text
353
353
354 If only the default is set, we'll use that for the feature, too
354 If only the default is set, we'll use that for the feature, too
355 $ cp $HGRCPATH.pretest $HGRCPATH
355 $ cp $HGRCPATH.pretest $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
356 $ cat <<EOF >> $HGRCPATH
357 > [ui]
357 > [ui]
358 > interface = curses
358 > interface = curses
359 > EOF
359 > EOF
360 $ chunkselectorinterface
360 $ chunkselectorinterface
361 curses
361 curses
362
362
363 It is possible to override the default interface with a feature specific
363 It is possible to override the default interface with a feature specific
364 interface
364 interface
365 $ cp $HGRCPATH.pretest $HGRCPATH
365 $ cp $HGRCPATH.pretest $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
366 $ cat <<EOF >> $HGRCPATH
367 > [ui]
367 > [ui]
368 > interface = text
368 > interface = text
369 > interface.chunkselector = curses
369 > interface.chunkselector = curses
370 > EOF
370 > EOF
371
371
372 $ chunkselectorinterface
372 $ chunkselectorinterface
373 curses
373 curses
374
374
375 $ cp $HGRCPATH.pretest $HGRCPATH
375 $ cp $HGRCPATH.pretest $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
376 $ cat <<EOF >> $HGRCPATH
377 > [ui]
377 > [ui]
378 > interface = curses
378 > interface = curses
379 > interface.chunkselector = text
379 > interface.chunkselector = text
380 > EOF
380 > EOF
381
381
382 $ chunkselectorinterface
382 $ chunkselectorinterface
383 text
383 text
384
384
385 If a bad interface name is given, we use the default value (with a nice
385 If a bad interface name is given, we use the default value (with a nice
386 error message to suggest that the configuration needs to be fixed)
386 error message to suggest that the configuration needs to be fixed)
387
387
388 $ cp $HGRCPATH.pretest $HGRCPATH
388 $ cp $HGRCPATH.pretest $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
389 $ cat <<EOF >> $HGRCPATH
390 > [ui]
390 > [ui]
391 > interface = blah
391 > interface = blah
392 > EOF
392 > EOF
393 $ chunkselectorinterface
393 $ chunkselectorinterface
394 invalid value for ui.interface: blah (using text)
394 invalid value for ui.interface: blah (using text)
395 text
395 text
396
396
397 $ cp $HGRCPATH.pretest $HGRCPATH
397 $ cp $HGRCPATH.pretest $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
398 $ cat <<EOF >> $HGRCPATH
399 > [ui]
399 > [ui]
400 > interface = curses
400 > interface = curses
401 > interface.chunkselector = blah
401 > interface.chunkselector = blah
402 > EOF
402 > EOF
403 $ chunkselectorinterface
403 $ chunkselectorinterface
404 invalid value for ui.interface.chunkselector: blah (using curses)
404 invalid value for ui.interface.chunkselector: blah (using curses)
405 curses
405 curses
406
406
407 $ cp $HGRCPATH.pretest $HGRCPATH
407 $ cp $HGRCPATH.pretest $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
408 $ cat <<EOF >> $HGRCPATH
409 > [ui]
409 > [ui]
410 > interface = blah
410 > interface = blah
411 > interface.chunkselector = curses
411 > interface.chunkselector = curses
412 > EOF
412 > EOF
413 $ chunkselectorinterface
413 $ chunkselectorinterface
414 invalid value for ui.interface: blah
414 invalid value for ui.interface: blah
415 curses
415 curses
416
416
417 $ cp $HGRCPATH.pretest $HGRCPATH
417 $ cp $HGRCPATH.pretest $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
418 $ cat <<EOF >> $HGRCPATH
419 > [ui]
419 > [ui]
420 > interface = blah
420 > interface = blah
421 > interface.chunkselector = blah
421 > interface.chunkselector = blah
422 > EOF
422 > EOF
423 $ chunkselectorinterface
423 $ chunkselectorinterface
424 invalid value for ui.interface: blah
424 invalid value for ui.interface: blah
425 invalid value for ui.interface.chunkselector: blah (using text)
425 invalid value for ui.interface.chunkselector: blah (using text)
426 text
426 text
@@ -1,429 +1,429 b''
1 #require hardlink reporevlogstore
1 #require hardlink reporevlogstore
2
2
3 $ cat > nlinks.py <<EOF
3 $ cat > nlinks.py <<EOF
4 > from __future__ import print_function
4 > from __future__ import print_function
5 > import sys
5 > import sys
6 > from mercurial import util
6 > from mercurial import util
7 > for f in sorted(sys.stdin.readlines()):
7 > for f in sorted(sys.stdin.readlines()):
8 > f = f[:-1]
8 > f = f[:-1]
9 > print(util.nlinks(f), f)
9 > print(util.nlinks(f), f)
10 > EOF
10 > EOF
11
11
12 $ nlinksdir()
12 $ nlinksdir()
13 > {
13 > {
14 > find "$@" -type f | $PYTHON $TESTTMP/nlinks.py
14 > find "$@" -type f | $PYTHON $TESTTMP/nlinks.py
15 > }
15 > }
16
16
17 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
17 Some implementations of cp can't create hardlinks (replaces 'cp -al' on Linux):
18
18
19 $ cat > linkcp.py <<EOF
19 $ cat > linkcp.py <<EOF
20 > from __future__ import absolute_import
20 > from __future__ import absolute_import
21 > import sys
21 > import sys
22 > from mercurial import util
22 > from mercurial import util
23 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
23 > util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
24 > EOF
24 > EOF
25
25
26 $ linkcp()
26 $ linkcp()
27 > {
27 > {
28 > $PYTHON $TESTTMP/linkcp.py $1 $2
28 > $PYTHON $TESTTMP/linkcp.py $1 $2
29 > }
29 > }
30
30
31 Prepare repo r1:
31 Prepare repo r1:
32
32
33 $ hg init r1
33 $ hg init r1
34 $ cd r1
34 $ cd r1
35
35
36 $ echo c1 > f1
36 $ echo c1 > f1
37 $ hg add f1
37 $ hg add f1
38 $ hg ci -m0
38 $ hg ci -m0
39
39
40 $ mkdir d1
40 $ mkdir d1
41 $ cd d1
41 $ cd d1
42 $ echo c2 > f2
42 $ echo c2 > f2
43 $ hg add f2
43 $ hg add f2
44 $ hg ci -m1
44 $ hg ci -m1
45 $ cd ../..
45 $ cd ../..
46
46
47 $ nlinksdir r1/.hg/store
47 $ nlinksdir r1/.hg/store
48 1 r1/.hg/store/00changelog.i
48 1 r1/.hg/store/00changelog.i
49 1 r1/.hg/store/00manifest.i
49 1 r1/.hg/store/00manifest.i
50 1 r1/.hg/store/data/d1/f2.i
50 1 r1/.hg/store/data/d1/f2.i
51 1 r1/.hg/store/data/f1.i
51 1 r1/.hg/store/data/f1.i
52 1 r1/.hg/store/fncache (repofncache !)
52 1 r1/.hg/store/fncache (repofncache !)
53 1 r1/.hg/store/phaseroots
53 1 r1/.hg/store/phaseroots
54 1 r1/.hg/store/undo
54 1 r1/.hg/store/undo
55 1 r1/.hg/store/undo.backup.fncache (repofncache !)
55 1 r1/.hg/store/undo.backup.fncache (repofncache !)
56 1 r1/.hg/store/undo.backupfiles
56 1 r1/.hg/store/undo.backupfiles
57 1 r1/.hg/store/undo.phaseroots
57 1 r1/.hg/store/undo.phaseroots
58
58
59
59
60 Create hardlinked clone r2:
60 Create hardlinked clone r2:
61
61
62 $ hg clone -U --debug r1 r2 --config progress.debug=true
62 $ hg clone -U --debug r1 r2 --config progress.debug=true
63 linking: 1
63 linking: 1
64 linking: 2
64 linking: 2
65 linking: 3
65 linking: 3
66 linking: 4
66 linking: 4
67 linking: 5
67 linking: 5
68 linking: 6
68 linking: 6
69 linking: 7
69 linking: 7
70 linked 7 files
70 linked 7 files
71
71
72 Create non-hardlinked clone r3:
72 Create non-hardlinked clone r3:
73
73
74 $ hg clone --pull r1 r3
74 $ hg clone --pull r1 r3
75 requesting all changes
75 requesting all changes
76 adding changesets
76 adding changesets
77 adding manifests
77 adding manifests
78 adding file changes
78 adding file changes
79 added 2 changesets with 2 changes to 2 files
79 added 2 changesets with 2 changes to 2 files
80 new changesets 40d85e9847f2:7069c422939c
80 new changesets 40d85e9847f2:7069c422939c
81 updating to branch default
81 updating to branch default
82 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
83
83
84
84
85 Repos r1 and r2 should now contain hardlinked files:
85 Repos r1 and r2 should now contain hardlinked files:
86
86
87 $ nlinksdir r1/.hg/store
87 $ nlinksdir r1/.hg/store
88 2 r1/.hg/store/00changelog.i
88 2 r1/.hg/store/00changelog.i
89 2 r1/.hg/store/00manifest.i
89 2 r1/.hg/store/00manifest.i
90 2 r1/.hg/store/data/d1/f2.i
90 2 r1/.hg/store/data/d1/f2.i
91 2 r1/.hg/store/data/f1.i
91 2 r1/.hg/store/data/f1.i
92 2 r1/.hg/store/fncache (repofncache !)
92 2 r1/.hg/store/fncache (repofncache !)
93 1 r1/.hg/store/phaseroots
93 1 r1/.hg/store/phaseroots
94 1 r1/.hg/store/undo
94 1 r1/.hg/store/undo
95 1 r1/.hg/store/undo.backup.fncache (repofncache !)
95 1 r1/.hg/store/undo.backup.fncache (repofncache !)
96 1 r1/.hg/store/undo.backupfiles
96 1 r1/.hg/store/undo.backupfiles
97 1 r1/.hg/store/undo.phaseroots
97 1 r1/.hg/store/undo.phaseroots
98
98
99 $ nlinksdir r2/.hg/store
99 $ nlinksdir r2/.hg/store
100 2 r2/.hg/store/00changelog.i
100 2 r2/.hg/store/00changelog.i
101 2 r2/.hg/store/00manifest.i
101 2 r2/.hg/store/00manifest.i
102 2 r2/.hg/store/data/d1/f2.i
102 2 r2/.hg/store/data/d1/f2.i
103 2 r2/.hg/store/data/f1.i
103 2 r2/.hg/store/data/f1.i
104 2 r2/.hg/store/fncache (repofncache !)
104 2 r2/.hg/store/fncache (repofncache !)
105
105
106 Repo r3 should not be hardlinked:
106 Repo r3 should not be hardlinked:
107
107
108 $ nlinksdir r3/.hg/store
108 $ nlinksdir r3/.hg/store
109 1 r3/.hg/store/00changelog.i
109 1 r3/.hg/store/00changelog.i
110 1 r3/.hg/store/00manifest.i
110 1 r3/.hg/store/00manifest.i
111 1 r3/.hg/store/data/d1/f2.i
111 1 r3/.hg/store/data/d1/f2.i
112 1 r3/.hg/store/data/f1.i
112 1 r3/.hg/store/data/f1.i
113 1 r3/.hg/store/fncache (repofncache !)
113 1 r3/.hg/store/fncache (repofncache !)
114 1 r3/.hg/store/phaseroots
114 1 r3/.hg/store/phaseroots
115 1 r3/.hg/store/undo
115 1 r3/.hg/store/undo
116 1 r3/.hg/store/undo.backupfiles
116 1 r3/.hg/store/undo.backupfiles
117 1 r3/.hg/store/undo.phaseroots
117 1 r3/.hg/store/undo.phaseroots
118
118
119
119
120 Create a non-inlined filelog in r3:
120 Create a non-inlined filelog in r3:
121
121
122 $ cd r3/d1
122 $ cd r3/d1
123 >>> f = open('data1', 'wb')
123 >>> f = open('data1', 'wb')
124 >>> for x in range(10000):
124 >>> for x in range(10000):
125 ... f.write("%s\n" % str(x))
125 ... f.write(b"%d\n" % x) and None
126 >>> f.close()
126 >>> f.close()
127 $ for j in 0 1 2 3 4 5 6 7 8 9; do
127 $ for j in 0 1 2 3 4 5 6 7 8 9; do
128 > cat data1 >> f2
128 > cat data1 >> f2
129 > hg commit -m$j
129 > hg commit -m$j
130 > done
130 > done
131 $ cd ../..
131 $ cd ../..
132
132
133 $ nlinksdir r3/.hg/store
133 $ nlinksdir r3/.hg/store
134 1 r3/.hg/store/00changelog.i
134 1 r3/.hg/store/00changelog.i
135 1 r3/.hg/store/00manifest.i
135 1 r3/.hg/store/00manifest.i
136 1 r3/.hg/store/data/d1/f2.d
136 1 r3/.hg/store/data/d1/f2.d
137 1 r3/.hg/store/data/d1/f2.i
137 1 r3/.hg/store/data/d1/f2.i
138 1 r3/.hg/store/data/f1.i
138 1 r3/.hg/store/data/f1.i
139 1 r3/.hg/store/fncache (repofncache !)
139 1 r3/.hg/store/fncache (repofncache !)
140 1 r3/.hg/store/phaseroots
140 1 r3/.hg/store/phaseroots
141 1 r3/.hg/store/undo
141 1 r3/.hg/store/undo
142 1 r3/.hg/store/undo.backup.fncache (repofncache !)
142 1 r3/.hg/store/undo.backup.fncache (repofncache !)
143 1 r3/.hg/store/undo.backup.phaseroots
143 1 r3/.hg/store/undo.backup.phaseroots
144 1 r3/.hg/store/undo.backupfiles
144 1 r3/.hg/store/undo.backupfiles
145 1 r3/.hg/store/undo.phaseroots
145 1 r3/.hg/store/undo.phaseroots
146
146
147 Push to repo r1 should break up most hardlinks in r2:
147 Push to repo r1 should break up most hardlinks in r2:
148
148
149 $ hg -R r2 verify
149 $ hg -R r2 verify
150 checking changesets
150 checking changesets
151 checking manifests
151 checking manifests
152 crosschecking files in changesets and manifests
152 crosschecking files in changesets and manifests
153 checking files
153 checking files
154 2 files, 2 changesets, 2 total revisions
154 2 files, 2 changesets, 2 total revisions
155
155
156 $ cd r3
156 $ cd r3
157 $ hg push
157 $ hg push
158 pushing to $TESTTMP/r1
158 pushing to $TESTTMP/r1
159 searching for changes
159 searching for changes
160 adding changesets
160 adding changesets
161 adding manifests
161 adding manifests
162 adding file changes
162 adding file changes
163 added 10 changesets with 10 changes to 1 files
163 added 10 changesets with 10 changes to 1 files
164
164
165 $ cd ..
165 $ cd ..
166
166
167 $ nlinksdir r2/.hg/store
167 $ nlinksdir r2/.hg/store
168 1 r2/.hg/store/00changelog.i
168 1 r2/.hg/store/00changelog.i
169 1 r2/.hg/store/00manifest.i
169 1 r2/.hg/store/00manifest.i
170 1 r2/.hg/store/data/d1/f2.i
170 1 r2/.hg/store/data/d1/f2.i
171 2 r2/.hg/store/data/f1.i
171 2 r2/.hg/store/data/f1.i
172 [12] r2/\.hg/store/fncache (re) (repofncache !)
172 [12] r2/\.hg/store/fncache (re) (repofncache !)
173
173
174 #if hardlink-whitelisted repofncache
174 #if hardlink-whitelisted repofncache
175 $ nlinksdir r2/.hg/store/fncache
175 $ nlinksdir r2/.hg/store/fncache
176 2 r2/.hg/store/fncache
176 2 r2/.hg/store/fncache
177 #endif
177 #endif
178
178
179 $ hg -R r2 verify
179 $ hg -R r2 verify
180 checking changesets
180 checking changesets
181 checking manifests
181 checking manifests
182 crosschecking files in changesets and manifests
182 crosschecking files in changesets and manifests
183 checking files
183 checking files
184 2 files, 2 changesets, 2 total revisions
184 2 files, 2 changesets, 2 total revisions
185
185
186
186
187 $ cd r1
187 $ cd r1
188 $ hg up
188 $ hg up
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
190
190
191 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
191 Committing a change to f1 in r1 must break up hardlink f1.i in r2:
192
192
193 $ echo c1c1 >> f1
193 $ echo c1c1 >> f1
194 $ hg ci -m00
194 $ hg ci -m00
195 $ cd ..
195 $ cd ..
196
196
197 $ nlinksdir r2/.hg/store
197 $ nlinksdir r2/.hg/store
198 1 r2/.hg/store/00changelog.i
198 1 r2/.hg/store/00changelog.i
199 1 r2/.hg/store/00manifest.i
199 1 r2/.hg/store/00manifest.i
200 1 r2/.hg/store/data/d1/f2.i
200 1 r2/.hg/store/data/d1/f2.i
201 1 r2/.hg/store/data/f1.i
201 1 r2/.hg/store/data/f1.i
202 [12] r2/\.hg/store/fncache (re) (repofncache !)
202 [12] r2/\.hg/store/fncache (re) (repofncache !)
203
203
204 #if hardlink-whitelisted repofncache
204 #if hardlink-whitelisted repofncache
205 $ nlinksdir r2/.hg/store/fncache
205 $ nlinksdir r2/.hg/store/fncache
206 2 r2/.hg/store/fncache
206 2 r2/.hg/store/fncache
207 #endif
207 #endif
208
208
209 Create a file which exec permissions we will change
209 Create a file which exec permissions we will change
210 $ cd r3
210 $ cd r3
211 $ echo "echo hello world" > f3
211 $ echo "echo hello world" > f3
212 $ hg add f3
212 $ hg add f3
213 $ hg ci -mf3
213 $ hg ci -mf3
214 $ cd ..
214 $ cd ..
215
215
216 $ cd r3
216 $ cd r3
217 $ hg tip --template '{rev}:{node|short}\n'
217 $ hg tip --template '{rev}:{node|short}\n'
218 12:d3b77733a28a
218 12:d3b77733a28a
219 $ echo bla > f1
219 $ echo bla > f1
220 $ chmod +x f3
220 $ chmod +x f3
221 $ hg ci -m1
221 $ hg ci -m1
222 $ cd ..
222 $ cd ..
223
223
224 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
224 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):
225
225
226 $ linkcp r3 r4
226 $ linkcp r3 r4
227
227
228 'checklink' is produced by hardlinking a symlink, which is undefined whether
228 'checklink' is produced by hardlinking a symlink, which is undefined whether
229 the symlink should be followed or not. It does behave differently on Linux and
229 the symlink should be followed or not. It does behave differently on Linux and
230 BSD. Just remove it so the test pass on both platforms.
230 BSD. Just remove it so the test pass on both platforms.
231
231
232 $ rm -f r4/.hg/cache/checklink
232 $ rm -f r4/.hg/cache/checklink
233
233
234 r4 has hardlinks in the working dir (not just inside .hg):
234 r4 has hardlinks in the working dir (not just inside .hg):
235
235
236 $ nlinksdir r4
236 $ nlinksdir r4
237 2 r4/.hg/00changelog.i
237 2 r4/.hg/00changelog.i
238 2 r4/.hg/branch
238 2 r4/.hg/branch
239 2 r4/.hg/cache/branch2-base
239 2 r4/.hg/cache/branch2-base
240 2 r4/.hg/cache/branch2-served
240 2 r4/.hg/cache/branch2-served
241 2 r4/.hg/cache/checkisexec (execbit !)
241 2 r4/.hg/cache/checkisexec (execbit !)
242 ? r4/.hg/cache/checklink-target (glob) (symlink !)
242 ? r4/.hg/cache/checklink-target (glob) (symlink !)
243 2 r4/.hg/cache/checknoexec (execbit !)
243 2 r4/.hg/cache/checknoexec (execbit !)
244 2 r4/.hg/cache/rbc-names-v1
244 2 r4/.hg/cache/rbc-names-v1
245 2 r4/.hg/cache/rbc-revs-v1
245 2 r4/.hg/cache/rbc-revs-v1
246 2 r4/.hg/dirstate
246 2 r4/.hg/dirstate
247 2 r4/.hg/fsmonitor.state (fsmonitor !)
247 2 r4/.hg/fsmonitor.state (fsmonitor !)
248 2 r4/.hg/hgrc
248 2 r4/.hg/hgrc
249 2 r4/.hg/last-message.txt
249 2 r4/.hg/last-message.txt
250 2 r4/.hg/requires
250 2 r4/.hg/requires
251 2 r4/.hg/store/00changelog.i
251 2 r4/.hg/store/00changelog.i
252 2 r4/.hg/store/00manifest.i
252 2 r4/.hg/store/00manifest.i
253 2 r4/.hg/store/data/d1/f2.d
253 2 r4/.hg/store/data/d1/f2.d
254 2 r4/.hg/store/data/d1/f2.i
254 2 r4/.hg/store/data/d1/f2.i
255 2 r4/.hg/store/data/f1.i
255 2 r4/.hg/store/data/f1.i
256 2 r4/.hg/store/data/f3.i
256 2 r4/.hg/store/data/f3.i
257 2 r4/.hg/store/fncache (repofncache !)
257 2 r4/.hg/store/fncache (repofncache !)
258 2 r4/.hg/store/phaseroots
258 2 r4/.hg/store/phaseroots
259 2 r4/.hg/store/undo
259 2 r4/.hg/store/undo
260 2 r4/.hg/store/undo.backup.fncache (repofncache !)
260 2 r4/.hg/store/undo.backup.fncache (repofncache !)
261 2 r4/.hg/store/undo.backup.phaseroots
261 2 r4/.hg/store/undo.backup.phaseroots
262 2 r4/.hg/store/undo.backupfiles
262 2 r4/.hg/store/undo.backupfiles
263 2 r4/.hg/store/undo.phaseroots
263 2 r4/.hg/store/undo.phaseroots
264 [24] r4/\.hg/undo\.backup\.dirstate (re)
264 [24] r4/\.hg/undo\.backup\.dirstate (re)
265 2 r4/.hg/undo.bookmarks
265 2 r4/.hg/undo.bookmarks
266 2 r4/.hg/undo.branch
266 2 r4/.hg/undo.branch
267 2 r4/.hg/undo.desc
267 2 r4/.hg/undo.desc
268 [24] r4/\.hg/undo\.dirstate (re)
268 [24] r4/\.hg/undo\.dirstate (re)
269 2 r4/d1/data1
269 2 r4/d1/data1
270 2 r4/d1/f2
270 2 r4/d1/f2
271 2 r4/f1
271 2 r4/f1
272 2 r4/f3
272 2 r4/f3
273
273
274 Update back to revision 12 in r4 should break hardlink of file f1 and f3:
274 Update back to revision 12 in r4 should break hardlink of file f1 and f3:
275 #if hardlink-whitelisted
275 #if hardlink-whitelisted
276 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
276 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
277 4 r4/.hg/undo.backup.dirstate
277 4 r4/.hg/undo.backup.dirstate
278 4 r4/.hg/undo.dirstate
278 4 r4/.hg/undo.dirstate
279 #endif
279 #endif
280
280
281
281
282 $ hg -R r4 up 12
282 $ hg -R r4 up 12
283 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (execbit !)
283 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (execbit !)
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-execbit !)
284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (no-execbit !)
285
285
286 $ nlinksdir r4
286 $ nlinksdir r4
287 2 r4/.hg/00changelog.i
287 2 r4/.hg/00changelog.i
288 1 r4/.hg/branch
288 1 r4/.hg/branch
289 2 r4/.hg/cache/branch2-base
289 2 r4/.hg/cache/branch2-base
290 2 r4/.hg/cache/branch2-served
290 2 r4/.hg/cache/branch2-served
291 2 r4/.hg/cache/checkisexec (execbit !)
291 2 r4/.hg/cache/checkisexec (execbit !)
292 2 r4/.hg/cache/checklink-target (symlink !)
292 2 r4/.hg/cache/checklink-target (symlink !)
293 2 r4/.hg/cache/checknoexec (execbit !)
293 2 r4/.hg/cache/checknoexec (execbit !)
294 2 r4/.hg/cache/rbc-names-v1
294 2 r4/.hg/cache/rbc-names-v1
295 2 r4/.hg/cache/rbc-revs-v1
295 2 r4/.hg/cache/rbc-revs-v1
296 1 r4/.hg/dirstate
296 1 r4/.hg/dirstate
297 1 r4/.hg/fsmonitor.state (fsmonitor !)
297 1 r4/.hg/fsmonitor.state (fsmonitor !)
298 2 r4/.hg/hgrc
298 2 r4/.hg/hgrc
299 2 r4/.hg/last-message.txt
299 2 r4/.hg/last-message.txt
300 2 r4/.hg/requires
300 2 r4/.hg/requires
301 2 r4/.hg/store/00changelog.i
301 2 r4/.hg/store/00changelog.i
302 2 r4/.hg/store/00manifest.i
302 2 r4/.hg/store/00manifest.i
303 2 r4/.hg/store/data/d1/f2.d
303 2 r4/.hg/store/data/d1/f2.d
304 2 r4/.hg/store/data/d1/f2.i
304 2 r4/.hg/store/data/d1/f2.i
305 2 r4/.hg/store/data/f1.i
305 2 r4/.hg/store/data/f1.i
306 2 r4/.hg/store/data/f3.i
306 2 r4/.hg/store/data/f3.i
307 2 r4/.hg/store/fncache
307 2 r4/.hg/store/fncache
308 2 r4/.hg/store/phaseroots
308 2 r4/.hg/store/phaseroots
309 2 r4/.hg/store/undo
309 2 r4/.hg/store/undo
310 2 r4/.hg/store/undo.backup.fncache (repofncache !)
310 2 r4/.hg/store/undo.backup.fncache (repofncache !)
311 2 r4/.hg/store/undo.backup.phaseroots
311 2 r4/.hg/store/undo.backup.phaseroots
312 2 r4/.hg/store/undo.backupfiles
312 2 r4/.hg/store/undo.backupfiles
313 2 r4/.hg/store/undo.phaseroots
313 2 r4/.hg/store/undo.phaseroots
314 [24] r4/\.hg/undo\.backup\.dirstate (re)
314 [24] r4/\.hg/undo\.backup\.dirstate (re)
315 2 r4/.hg/undo.bookmarks
315 2 r4/.hg/undo.bookmarks
316 2 r4/.hg/undo.branch
316 2 r4/.hg/undo.branch
317 2 r4/.hg/undo.desc
317 2 r4/.hg/undo.desc
318 [24] r4/\.hg/undo\.dirstate (re)
318 [24] r4/\.hg/undo\.dirstate (re)
319 2 r4/d1/data1
319 2 r4/d1/data1
320 2 r4/d1/f2
320 2 r4/d1/f2
321 1 r4/f1
321 1 r4/f1
322 1 r4/f3 (execbit !)
322 1 r4/f3 (execbit !)
323 2 r4/f3 (no-execbit !)
323 2 r4/f3 (no-execbit !)
324
324
325 #if hardlink-whitelisted
325 #if hardlink-whitelisted
326 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
326 $ nlinksdir r4/.hg/undo.backup.dirstate r4/.hg/undo.dirstate
327 4 r4/.hg/undo.backup.dirstate
327 4 r4/.hg/undo.backup.dirstate
328 4 r4/.hg/undo.dirstate
328 4 r4/.hg/undo.dirstate
329 #endif
329 #endif
330
330
331 Test hardlinking outside hg:
331 Test hardlinking outside hg:
332
332
333 $ mkdir x
333 $ mkdir x
334 $ echo foo > x/a
334 $ echo foo > x/a
335
335
336 $ linkcp x y
336 $ linkcp x y
337 $ echo bar >> y/a
337 $ echo bar >> y/a
338
338
339 No diff if hardlink:
339 No diff if hardlink:
340
340
341 $ diff x/a y/a
341 $ diff x/a y/a
342
342
343 Test mq hardlinking:
343 Test mq hardlinking:
344
344
345 $ echo "[extensions]" >> $HGRCPATH
345 $ echo "[extensions]" >> $HGRCPATH
346 $ echo "mq=" >> $HGRCPATH
346 $ echo "mq=" >> $HGRCPATH
347
347
348 $ hg init a
348 $ hg init a
349 $ cd a
349 $ cd a
350
350
351 $ hg qimport -n foo - << EOF
351 $ hg qimport -n foo - << EOF
352 > # HG changeset patch
352 > # HG changeset patch
353 > # Date 1 0
353 > # Date 1 0
354 > diff -r 2588a8b53d66 a
354 > diff -r 2588a8b53d66 a
355 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
355 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
356 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
356 > +++ b/a Wed Jul 23 15:54:29 2008 +0200
357 > @@ -0,0 +1,1 @@
357 > @@ -0,0 +1,1 @@
358 > +a
358 > +a
359 > EOF
359 > EOF
360 adding foo to series file
360 adding foo to series file
361
361
362 $ hg qpush
362 $ hg qpush
363 applying foo
363 applying foo
364 now at: foo
364 now at: foo
365
365
366 $ cd ..
366 $ cd ..
367 $ linkcp a b
367 $ linkcp a b
368 $ cd b
368 $ cd b
369
369
370 $ hg qimport -n bar - << EOF
370 $ hg qimport -n bar - << EOF
371 > # HG changeset patch
371 > # HG changeset patch
372 > # Date 2 0
372 > # Date 2 0
373 > diff -r 2588a8b53d66 a
373 > diff -r 2588a8b53d66 a
374 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
374 > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
375 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
375 > +++ b/b Wed Jul 23 15:54:29 2008 +0200
376 > @@ -0,0 +1,1 @@
376 > @@ -0,0 +1,1 @@
377 > +b
377 > +b
378 > EOF
378 > EOF
379 adding bar to series file
379 adding bar to series file
380
380
381 $ hg qpush
381 $ hg qpush
382 applying bar
382 applying bar
383 now at: bar
383 now at: bar
384
384
385 $ cat .hg/patches/status
385 $ cat .hg/patches/status
386 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
386 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
387 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
387 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c:bar
388
388
389 $ cat .hg/patches/series
389 $ cat .hg/patches/series
390 foo
390 foo
391 bar
391 bar
392
392
393 $ cat ../a/.hg/patches/status
393 $ cat ../a/.hg/patches/status
394 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
394 430ed4828a74fa4047bc816a25500f7472ab4bfe:foo
395
395
396 $ cat ../a/.hg/patches/series
396 $ cat ../a/.hg/patches/series
397 foo
397 foo
398
398
399 Test tags hardlinking:
399 Test tags hardlinking:
400
400
401 $ hg qdel -r qbase:qtip
401 $ hg qdel -r qbase:qtip
402 patch foo finalized without changeset message
402 patch foo finalized without changeset message
403 patch bar finalized without changeset message
403 patch bar finalized without changeset message
404
404
405 $ hg tag -l lfoo
405 $ hg tag -l lfoo
406 $ hg tag foo
406 $ hg tag foo
407
407
408 $ cd ..
408 $ cd ..
409 $ linkcp b c
409 $ linkcp b c
410 $ cd c
410 $ cd c
411
411
412 $ hg tag -l -r 0 lbar
412 $ hg tag -l -r 0 lbar
413 $ hg tag -r 0 bar
413 $ hg tag -r 0 bar
414
414
415 $ cat .hgtags
415 $ cat .hgtags
416 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
416 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
417 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
417 430ed4828a74fa4047bc816a25500f7472ab4bfe bar
418
418
419 $ cat .hg/localtags
419 $ cat .hg/localtags
420 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
420 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
421 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
421 430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
422
422
423 $ cat ../b/.hgtags
423 $ cat ../b/.hgtags
424 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
424 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
425
425
426 $ cat ../b/.hg/localtags
426 $ cat ../b/.hg/localtags
427 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
427 4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
428
428
429 $ cd ..
429 $ cd ..
@@ -1,167 +1,167 b''
1 $ echo "[extensions]" >> $HGRCPATH
1 $ echo "[extensions]" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
2 $ echo "mq=" >> $HGRCPATH
3
3
4 $ tipparents() {
4 $ tipparents() {
5 > hg parents --template "{rev}:{node|short} {desc|firstline}\n" -r tip
5 > hg parents --template "{rev}:{node|short} {desc|firstline}\n" -r tip
6 > }
6 > }
7
7
8 Test import and merge diffs
8 Test import and merge diffs
9
9
10 $ hg init repo
10 $ hg init repo
11 $ cd repo
11 $ cd repo
12 $ echo a > a
12 $ echo a > a
13 $ hg ci -Am adda
13 $ hg ci -Am adda
14 adding a
14 adding a
15 $ echo a >> a
15 $ echo a >> a
16 $ hg ci -m changea
16 $ hg ci -m changea
17 $ echo c > c
17 $ echo c > c
18 $ hg ci -Am addc
18 $ hg ci -Am addc
19 adding c
19 adding c
20 $ hg up 0
20 $ hg up 0
21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 $ echo b > b
22 $ echo b > b
23 $ hg ci -Am addb
23 $ hg ci -Am addb
24 adding b
24 adding b
25 created new head
25 created new head
26 $ hg up 1
26 $ hg up 1
27 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
27 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
28 $ hg merge 3
28 $ hg merge 3
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 (branch merge, don't forget to commit)
30 (branch merge, don't forget to commit)
31 $ hg ci -m merge
31 $ hg ci -m merge
32 $ hg export . > ../merge.diff
32 $ hg export . > ../merge.diff
33 $ grep -v '^merge$' ../merge.diff > ../merge.nomsg.diff
33 $ grep -v '^merge$' ../merge.diff > ../merge.nomsg.diff
34 $ cd ..
34 $ cd ..
35 $ hg clone -r2 repo repo2
35 $ hg clone -r2 repo repo2
36 adding changesets
36 adding changesets
37 adding manifests
37 adding manifests
38 adding file changes
38 adding file changes
39 added 3 changesets with 3 changes to 2 files
39 added 3 changesets with 3 changes to 2 files
40 new changesets 07f494440405:890ecaa90481
40 new changesets 07f494440405:890ecaa90481
41 updating to branch default
41 updating to branch default
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 $ cd repo2
43 $ cd repo2
44 $ hg pull -r3 ../repo
44 $ hg pull -r3 ../repo
45 pulling from ../repo
45 pulling from ../repo
46 searching for changes
46 searching for changes
47 adding changesets
47 adding changesets
48 adding manifests
48 adding manifests
49 adding file changes
49 adding file changes
50 added 1 changesets with 1 changes to 1 files (+1 heads)
50 added 1 changesets with 1 changes to 1 files (+1 heads)
51 new changesets 102a90ea7b4a
51 new changesets 102a90ea7b4a
52 (run 'hg heads' to see heads, 'hg merge' to merge)
52 (run 'hg heads' to see heads, 'hg merge' to merge)
53
53
54 Test without --exact and diff.p1 == workingdir.p1
54 Test without --exact and diff.p1 == workingdir.p1
55
55
56 $ hg up 1
56 $ hg up 1
57 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
57 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 $ cat > $TESTTMP/editor.sh <<EOF
58 $ cat > $TESTTMP/editor.sh <<EOF
59 > env | grep HGEDITFORM
59 > env | grep HGEDITFORM
60 > echo merge > \$1
60 > echo merge > \$1
61 > EOF
61 > EOF
62 $ HGEDITOR="sh $TESTTMP/editor.sh" hg import --edit ../merge.nomsg.diff
62 $ HGEDITOR="sh $TESTTMP/editor.sh" hg import --edit ../merge.nomsg.diff
63 applying ../merge.nomsg.diff
63 applying ../merge.nomsg.diff
64 HGEDITFORM=import.normal.merge
64 HGEDITFORM=import.normal.merge
65 $ tipparents
65 $ tipparents
66 1:540395c44225 changea
66 1:540395c44225 changea
67 3:102a90ea7b4a addb
67 3:102a90ea7b4a addb
68 $ hg strip --no-backup tip
68 $ hg strip --no-backup tip
69 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
69 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
70
70
71 Test without --exact and diff.p1 != workingdir.p1
71 Test without --exact and diff.p1 != workingdir.p1
72
72
73 $ hg up 2
73 $ hg up 2
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 $ hg import ../merge.diff
75 $ hg import ../merge.diff
76 applying ../merge.diff
76 applying ../merge.diff
77 warning: import the patch as a normal revision
77 warning: import the patch as a normal revision
78 (use --exact to import the patch as a merge)
78 (use --exact to import the patch as a merge)
79 $ tipparents
79 $ tipparents
80 2:890ecaa90481 addc
80 2:890ecaa90481 addc
81 $ hg strip --no-backup tip
81 $ hg strip --no-backup tip
82 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
82 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
83
83
84 Test with --exact
84 Test with --exact
85
85
86 $ hg import --exact ../merge.diff
86 $ hg import --exact ../merge.diff
87 applying ../merge.diff
87 applying ../merge.diff
88 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
88 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
89 $ tipparents
89 $ tipparents
90 1:540395c44225 changea
90 1:540395c44225 changea
91 3:102a90ea7b4a addb
91 3:102a90ea7b4a addb
92 $ hg strip --no-backup tip
92 $ hg strip --no-backup tip
93 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
93 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
94
94
95 Test with --bypass and diff.p1 == workingdir.p1
95 Test with --bypass and diff.p1 == workingdir.p1
96
96
97 $ hg up 1
97 $ hg up 1
98 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
98 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 $ hg import --bypass ../merge.diff
99 $ hg import --bypass ../merge.diff
100 applying ../merge.diff
100 applying ../merge.diff
101 $ tipparents
101 $ tipparents
102 1:540395c44225 changea
102 1:540395c44225 changea
103 3:102a90ea7b4a addb
103 3:102a90ea7b4a addb
104 $ hg strip --no-backup tip
104 $ hg strip --no-backup tip
105
105
106 Test with --bypass and diff.p1 != workingdir.p1
106 Test with --bypass and diff.p1 != workingdir.p1
107
107
108 $ hg up 2
108 $ hg up 2
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 $ hg import --bypass ../merge.diff
110 $ hg import --bypass ../merge.diff
111 applying ../merge.diff
111 applying ../merge.diff
112 warning: import the patch as a normal revision
112 warning: import the patch as a normal revision
113 (use --exact to import the patch as a merge)
113 (use --exact to import the patch as a merge)
114 $ tipparents
114 $ tipparents
115 2:890ecaa90481 addc
115 2:890ecaa90481 addc
116 $ hg strip --no-backup tip
116 $ hg strip --no-backup tip
117
117
118 Test with --bypass and --exact
118 Test with --bypass and --exact
119
119
120 $ hg import --bypass --exact ../merge.diff
120 $ hg import --bypass --exact ../merge.diff
121 applying ../merge.diff
121 applying ../merge.diff
122 $ tipparents
122 $ tipparents
123 1:540395c44225 changea
123 1:540395c44225 changea
124 3:102a90ea7b4a addb
124 3:102a90ea7b4a addb
125 $ hg strip --no-backup tip
125 $ hg strip --no-backup tip
126
126
127 $ cd ..
127 $ cd ..
128
128
129 Test that --exact on a bad header doesn't corrupt the repo (issue3616)
129 Test that --exact on a bad header doesn't corrupt the repo (issue3616)
130
130
131 $ hg init repo3
131 $ hg init repo3
132 $ cd repo3
132 $ cd repo3
133 $ echo a>a
133 $ echo a>a
134 $ hg ci -Aqm0
134 $ hg ci -Aqm0
135 $ echo a>>a
135 $ echo a>>a
136 $ hg ci -m1
136 $ hg ci -m1
137 $ echo a>>a
137 $ echo a>>a
138 $ hg ci -m2
138 $ hg ci -m2
139 $ echo a>a
139 $ echo a>a
140 $ echo b>>a
140 $ echo b>>a
141 $ echo a>>a
141 $ echo a>>a
142 $ hg ci -m3
142 $ hg ci -m3
143 $ hg export 2 | head -7 > ../a.patch
143 $ hg export 2 | head -7 > ../a.patch
144 $ hg export tip > out
144 $ hg export tip > out
145 >>> apatch = open("../a.patch", "ab")
145 >>> apatch = open("../a.patch", "ab")
146 >>> apatch.write("".join(open("out").readlines()[7:]))
146 >>> apatch.write(b"".join(open("out", 'rb').readlines()[7:])) and None
147
147
148 $ cd ..
148 $ cd ..
149 $ hg clone -qr0 repo3 repo3-clone
149 $ hg clone -qr0 repo3 repo3-clone
150 $ cd repo3-clone
150 $ cd repo3-clone
151 $ hg pull -qr1 ../repo3
151 $ hg pull -qr1 ../repo3
152
152
153 $ hg import --exact ../a.patch
153 $ hg import --exact ../a.patch
154 applying ../a.patch
154 applying ../a.patch
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 patching file a
156 patching file a
157 Hunk #1 succeeded at 1 with fuzz 1 (offset -1 lines).
157 Hunk #1 succeeded at 1 with fuzz 1 (offset -1 lines).
158 transaction abort!
158 transaction abort!
159 rollback completed
159 rollback completed
160 abort: patch is damaged or loses information
160 abort: patch is damaged or loses information
161 [255]
161 [255]
162 $ hg verify
162 $ hg verify
163 checking changesets
163 checking changesets
164 checking manifests
164 checking manifests
165 crosschecking files in changesets and manifests
165 crosschecking files in changesets and manifests
166 checking files
166 checking files
167 1 files, 2 changesets, 2 total revisions
167 1 files, 2 changesets, 2 total revisions
@@ -1,432 +1,432 b''
1 Revert interactive tests
1 Revert interactive tests
2 1 add and commit file f
2 1 add and commit file f
3 2 add commit file folder1/g
3 2 add commit file folder1/g
4 3 add and commit file folder2/h
4 3 add and commit file folder2/h
5 4 add and commit file folder1/i
5 4 add and commit file folder1/i
6 5 commit change to file f
6 5 commit change to file f
7 6 commit changes to files folder1/g folder2/h
7 6 commit changes to files folder1/g folder2/h
8 7 commit changes to files folder1/g folder2/h
8 7 commit changes to files folder1/g folder2/h
9 8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and
9 8 revert interactive to commit id 2 (line 3 above), check that folder1/i is removed and
10 9 make workdir match 7
10 9 make workdir match 7
11 10 run the same test than 8 from within folder1 and check same expectations
11 10 run the same test than 8 from within folder1 and check same expectations
12
12
13 $ cat <<EOF >> $HGRCPATH
13 $ cat <<EOF >> $HGRCPATH
14 > [ui]
14 > [ui]
15 > interactive = true
15 > interactive = true
16 > [extensions]
16 > [extensions]
17 > record =
17 > record =
18 > purge =
18 > purge =
19 > EOF
19 > EOF
20
20
21
21
22 $ mkdir -p a/folder1 a/folder2
22 $ mkdir -p a/folder1 a/folder2
23 $ cd a
23 $ cd a
24 $ hg init
24 $ hg init
25 >>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
25 >>> open('f', 'wb').write(b"1\n2\n3\n4\n5\n") and None
26 $ hg add f ; hg commit -m "adding f"
26 $ hg add f ; hg commit -m "adding f"
27 $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
27 $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
28 $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
28 $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
29 $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
29 $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
30 >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
30 >>> open('f', 'wb').write(b"a\n1\n2\n3\n4\n5\nb\n") and None
31 $ hg commit -m "modifying f"
31 $ hg commit -m "modifying f"
32 >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
32 >>> open('folder1/g', 'wb').write(b"c\n1\n2\n3\n4\n5\nd\n") and None
33 $ hg commit -m "modifying folder1/g"
33 $ hg commit -m "modifying folder1/g"
34 >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
34 >>> open('folder2/h', 'wb').write(b"e\n1\n2\n3\n4\n5\nf\n") and None
35 $ hg commit -m "modifying folder2/h"
35 $ hg commit -m "modifying folder2/h"
36 $ hg tip
36 $ hg tip
37 changeset: 6:59dd6e4ab63a
37 changeset: 6:59dd6e4ab63a
38 tag: tip
38 tag: tip
39 user: test
39 user: test
40 date: Thu Jan 01 00:00:00 1970 +0000
40 date: Thu Jan 01 00:00:00 1970 +0000
41 summary: modifying folder2/h
41 summary: modifying folder2/h
42
42
43 $ hg revert -i -r 2 --all -- << EOF
43 $ hg revert -i -r 2 --all -- << EOF
44 > y
44 > y
45 > y
45 > y
46 > y
46 > y
47 > y
47 > y
48 > y
48 > y
49 > ?
49 > ?
50 > y
50 > y
51 > n
51 > n
52 > n
52 > n
53 > EOF
53 > EOF
54 reverting f
54 reverting f
55 reverting folder1/g
55 reverting folder1/g
56 removing folder1/i
56 removing folder1/i
57 reverting folder2/h
57 reverting folder2/h
58 remove added file folder1/i (Yn)? y
58 remove added file folder1/i (Yn)? y
59 diff --git a/f b/f
59 diff --git a/f b/f
60 2 hunks, 2 lines changed
60 2 hunks, 2 lines changed
61 examine changes to 'f'? [Ynesfdaq?] y
61 examine changes to 'f'? [Ynesfdaq?] y
62
62
63 @@ -1,6 +1,5 @@
63 @@ -1,6 +1,5 @@
64 -a
64 -a
65 1
65 1
66 2
66 2
67 3
67 3
68 4
68 4
69 5
69 5
70 apply change 1/6 to 'f'? [Ynesfdaq?] y
70 apply change 1/6 to 'f'? [Ynesfdaq?] y
71
71
72 @@ -2,6 +1,5 @@
72 @@ -2,6 +1,5 @@
73 1
73 1
74 2
74 2
75 3
75 3
76 4
76 4
77 5
77 5
78 -b
78 -b
79 apply change 2/6 to 'f'? [Ynesfdaq?] y
79 apply change 2/6 to 'f'? [Ynesfdaq?] y
80
80
81 diff --git a/folder1/g b/folder1/g
81 diff --git a/folder1/g b/folder1/g
82 2 hunks, 2 lines changed
82 2 hunks, 2 lines changed
83 examine changes to 'folder1/g'? [Ynesfdaq?] y
83 examine changes to 'folder1/g'? [Ynesfdaq?] y
84
84
85 @@ -1,6 +1,5 @@
85 @@ -1,6 +1,5 @@
86 -c
86 -c
87 1
87 1
88 2
88 2
89 3
89 3
90 4
90 4
91 5
91 5
92 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
92 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] ?
93
93
94 y - yes, apply this change
94 y - yes, apply this change
95 n - no, skip this change
95 n - no, skip this change
96 e - edit this change manually
96 e - edit this change manually
97 s - skip remaining changes to this file
97 s - skip remaining changes to this file
98 f - apply remaining changes to this file
98 f - apply remaining changes to this file
99 d - done, skip remaining changes and files
99 d - done, skip remaining changes and files
100 a - apply all changes to all remaining files
100 a - apply all changes to all remaining files
101 q - quit, applying no changes
101 q - quit, applying no changes
102 ? - ? (display help)
102 ? - ? (display help)
103 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
103 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
104
104
105 @@ -2,6 +1,5 @@
105 @@ -2,6 +1,5 @@
106 1
106 1
107 2
107 2
108 3
108 3
109 4
109 4
110 5
110 5
111 -d
111 -d
112 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
112 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
113
113
114 diff --git a/folder2/h b/folder2/h
114 diff --git a/folder2/h b/folder2/h
115 2 hunks, 2 lines changed
115 2 hunks, 2 lines changed
116 examine changes to 'folder2/h'? [Ynesfdaq?] n
116 examine changes to 'folder2/h'? [Ynesfdaq?] n
117
117
118 $ cat f
118 $ cat f
119 1
119 1
120 2
120 2
121 3
121 3
122 4
122 4
123 5
123 5
124 $ cat folder1/g
124 $ cat folder1/g
125 1
125 1
126 2
126 2
127 3
127 3
128 4
128 4
129 5
129 5
130 d
130 d
131 $ cat folder2/h
131 $ cat folder2/h
132 e
132 e
133 1
133 1
134 2
134 2
135 3
135 3
136 4
136 4
137 5
137 5
138 f
138 f
139
139
140 Test that --interactive lift the need for --all
140 Test that --interactive lift the need for --all
141
141
142 $ echo q | hg revert -i -r 2
142 $ echo q | hg revert -i -r 2
143 reverting folder1/g
143 reverting folder1/g
144 reverting folder2/h
144 reverting folder2/h
145 diff --git a/folder1/g b/folder1/g
145 diff --git a/folder1/g b/folder1/g
146 1 hunks, 1 lines changed
146 1 hunks, 1 lines changed
147 examine changes to 'folder1/g'? [Ynesfdaq?] q
147 examine changes to 'folder1/g'? [Ynesfdaq?] q
148
148
149 abort: user quit
149 abort: user quit
150 [255]
150 [255]
151 $ ls folder1/
151 $ ls folder1/
152 g
152 g
153
153
154 Test that a noop revert doesn't do an unnecessary backup
154 Test that a noop revert doesn't do an unnecessary backup
155 $ (echo y; echo n) | hg revert -i -r 2 folder1/g
155 $ (echo y; echo n) | hg revert -i -r 2 folder1/g
156 diff --git a/folder1/g b/folder1/g
156 diff --git a/folder1/g b/folder1/g
157 1 hunks, 1 lines changed
157 1 hunks, 1 lines changed
158 examine changes to 'folder1/g'? [Ynesfdaq?] y
158 examine changes to 'folder1/g'? [Ynesfdaq?] y
159
159
160 @@ -3,4 +3,3 @@
160 @@ -3,4 +3,3 @@
161 3
161 3
162 4
162 4
163 5
163 5
164 -d
164 -d
165 apply this change to 'folder1/g'? [Ynesfdaq?] n
165 apply this change to 'folder1/g'? [Ynesfdaq?] n
166
166
167 $ ls folder1/
167 $ ls folder1/
168 g
168 g
169
169
170 Test --no-backup
170 Test --no-backup
171 $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g
171 $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g
172 diff --git a/folder1/g b/folder1/g
172 diff --git a/folder1/g b/folder1/g
173 1 hunks, 1 lines changed
173 1 hunks, 1 lines changed
174 examine changes to 'folder1/g'? [Ynesfdaq?] y
174 examine changes to 'folder1/g'? [Ynesfdaq?] y
175
175
176 @@ -3,4 +3,3 @@
176 @@ -3,4 +3,3 @@
177 3
177 3
178 4
178 4
179 5
179 5
180 -d
180 -d
181 apply this change to 'folder1/g'? [Ynesfdaq?] y
181 apply this change to 'folder1/g'? [Ynesfdaq?] y
182
182
183 $ ls folder1/
183 $ ls folder1/
184 g
184 g
185 >>> open('folder1/g', 'wb').write("1\n2\n3\n4\n5\nd\n")
185 >>> open('folder1/g', 'wb').write(b"1\n2\n3\n4\n5\nd\n") and None
186
186
187
187
188 $ hg update -C 6
188 $ hg update -C 6
189 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
189 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
190 $ hg revert -i -r 2 --all -- << EOF
190 $ hg revert -i -r 2 --all -- << EOF
191 > n
191 > n
192 > y
192 > y
193 > y
193 > y
194 > y
194 > y
195 > y
195 > y
196 > y
196 > y
197 > n
197 > n
198 > n
198 > n
199 > EOF
199 > EOF
200 reverting f
200 reverting f
201 reverting folder1/g
201 reverting folder1/g
202 removing folder1/i
202 removing folder1/i
203 reverting folder2/h
203 reverting folder2/h
204 remove added file folder1/i (Yn)? n
204 remove added file folder1/i (Yn)? n
205 diff --git a/f b/f
205 diff --git a/f b/f
206 2 hunks, 2 lines changed
206 2 hunks, 2 lines changed
207 examine changes to 'f'? [Ynesfdaq?] y
207 examine changes to 'f'? [Ynesfdaq?] y
208
208
209 @@ -1,6 +1,5 @@
209 @@ -1,6 +1,5 @@
210 -a
210 -a
211 1
211 1
212 2
212 2
213 3
213 3
214 4
214 4
215 5
215 5
216 apply change 1/6 to 'f'? [Ynesfdaq?] y
216 apply change 1/6 to 'f'? [Ynesfdaq?] y
217
217
218 @@ -2,6 +1,5 @@
218 @@ -2,6 +1,5 @@
219 1
219 1
220 2
220 2
221 3
221 3
222 4
222 4
223 5
223 5
224 -b
224 -b
225 apply change 2/6 to 'f'? [Ynesfdaq?] y
225 apply change 2/6 to 'f'? [Ynesfdaq?] y
226
226
227 diff --git a/folder1/g b/folder1/g
227 diff --git a/folder1/g b/folder1/g
228 2 hunks, 2 lines changed
228 2 hunks, 2 lines changed
229 examine changes to 'folder1/g'? [Ynesfdaq?] y
229 examine changes to 'folder1/g'? [Ynesfdaq?] y
230
230
231 @@ -1,6 +1,5 @@
231 @@ -1,6 +1,5 @@
232 -c
232 -c
233 1
233 1
234 2
234 2
235 3
235 3
236 4
236 4
237 5
237 5
238 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
238 apply change 3/6 to 'folder1/g'? [Ynesfdaq?] y
239
239
240 @@ -2,6 +1,5 @@
240 @@ -2,6 +1,5 @@
241 1
241 1
242 2
242 2
243 3
243 3
244 4
244 4
245 5
245 5
246 -d
246 -d
247 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
247 apply change 4/6 to 'folder1/g'? [Ynesfdaq?] n
248
248
249 diff --git a/folder2/h b/folder2/h
249 diff --git a/folder2/h b/folder2/h
250 2 hunks, 2 lines changed
250 2 hunks, 2 lines changed
251 examine changes to 'folder2/h'? [Ynesfdaq?] n
251 examine changes to 'folder2/h'? [Ynesfdaq?] n
252
252
253 $ cat f
253 $ cat f
254 1
254 1
255 2
255 2
256 3
256 3
257 4
257 4
258 5
258 5
259 $ cat folder1/g
259 $ cat folder1/g
260 1
260 1
261 2
261 2
262 3
262 3
263 4
263 4
264 5
264 5
265 d
265 d
266 $ cat folder2/h
266 $ cat folder2/h
267 e
267 e
268 1
268 1
269 2
269 2
270 3
270 3
271 4
271 4
272 5
272 5
273 f
273 f
274 $ hg st
274 $ hg st
275 M f
275 M f
276 M folder1/g
276 M folder1/g
277 $ hg revert --interactive f << EOF
277 $ hg revert --interactive f << EOF
278 > y
278 > y
279 > ?
279 > ?
280 > y
280 > y
281 > n
281 > n
282 > n
282 > n
283 > EOF
283 > EOF
284 diff --git a/f b/f
284 diff --git a/f b/f
285 2 hunks, 2 lines changed
285 2 hunks, 2 lines changed
286 examine changes to 'f'? [Ynesfdaq?] y
286 examine changes to 'f'? [Ynesfdaq?] y
287
287
288 @@ -1,6 +1,5 @@
288 @@ -1,6 +1,5 @@
289 -a
289 -a
290 1
290 1
291 2
291 2
292 3
292 3
293 4
293 4
294 5
294 5
295 discard change 1/2 to 'f'? [Ynesfdaq?] ?
295 discard change 1/2 to 'f'? [Ynesfdaq?] ?
296
296
297 y - yes, discard this change
297 y - yes, discard this change
298 n - no, skip this change
298 n - no, skip this change
299 e - edit this change manually
299 e - edit this change manually
300 s - skip remaining changes to this file
300 s - skip remaining changes to this file
301 f - discard remaining changes to this file
301 f - discard remaining changes to this file
302 d - done, skip remaining changes and files
302 d - done, skip remaining changes and files
303 a - discard all changes to all remaining files
303 a - discard all changes to all remaining files
304 q - quit, discarding no changes
304 q - quit, discarding no changes
305 ? - ? (display help)
305 ? - ? (display help)
306 discard change 1/2 to 'f'? [Ynesfdaq?] y
306 discard change 1/2 to 'f'? [Ynesfdaq?] y
307
307
308 @@ -2,6 +1,5 @@
308 @@ -2,6 +1,5 @@
309 1
309 1
310 2
310 2
311 3
311 3
312 4
312 4
313 5
313 5
314 -b
314 -b
315 discard change 2/2 to 'f'? [Ynesfdaq?] n
315 discard change 2/2 to 'f'? [Ynesfdaq?] n
316
316
317 $ hg st
317 $ hg st
318 M f
318 M f
319 M folder1/g
319 M folder1/g
320 ? f.orig
320 ? f.orig
321 $ cat f
321 $ cat f
322 a
322 a
323 1
323 1
324 2
324 2
325 3
325 3
326 4
326 4
327 5
327 5
328 $ cat f.orig
328 $ cat f.orig
329 1
329 1
330 2
330 2
331 3
331 3
332 4
332 4
333 5
333 5
334 $ rm f.orig
334 $ rm f.orig
335 $ hg update -C .
335 $ hg update -C .
336 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
336 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
337
337
338 Check editing files newly added by a revert
338 Check editing files newly added by a revert
339
339
340 1) Create a dummy editor changing 1 to 42
340 1) Create a dummy editor changing 1 to 42
341 $ cat > $TESTTMP/editor.sh << '__EOF__'
341 $ cat > $TESTTMP/editor.sh << '__EOF__'
342 > cat "$1" | sed "s/1/42/g" > tt
342 > cat "$1" | sed "s/1/42/g" > tt
343 > mv tt "$1"
343 > mv tt "$1"
344 > __EOF__
344 > __EOF__
345
345
346 2) Add k
346 2) Add k
347 $ printf "1\n" > k
347 $ printf "1\n" > k
348 $ hg add k
348 $ hg add k
349 $ hg commit -m "add k"
349 $ hg commit -m "add k"
350
350
351 3) Use interactive revert with editing (replacing +1 with +42):
351 3) Use interactive revert with editing (replacing +1 with +42):
352 $ printf "0\n2\n" > k
352 $ printf "0\n2\n" > k
353 $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i <<EOF
353 $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" hg revert -i <<EOF
354 > y
354 > y
355 > e
355 > e
356 > EOF
356 > EOF
357 reverting k
357 reverting k
358 diff --git a/k b/k
358 diff --git a/k b/k
359 1 hunks, 2 lines changed
359 1 hunks, 2 lines changed
360 examine changes to 'k'? [Ynesfdaq?] y
360 examine changes to 'k'? [Ynesfdaq?] y
361
361
362 @@ -1,1 +1,2 @@
362 @@ -1,1 +1,2 @@
363 -1
363 -1
364 +0
364 +0
365 +2
365 +2
366 discard this change to 'k'? [Ynesfdaq?] e
366 discard this change to 'k'? [Ynesfdaq?] e
367
367
368 $ cat k
368 $ cat k
369 42
369 42
370
370
371 $ hg update -C .
371 $ hg update -C .
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 $ hg purge
373 $ hg purge
374 $ touch newfile
374 $ touch newfile
375 $ hg add newfile
375 $ hg add newfile
376 $ hg status
376 $ hg status
377 A newfile
377 A newfile
378 $ hg revert -i <<EOF
378 $ hg revert -i <<EOF
379 > n
379 > n
380 > EOF
380 > EOF
381 forgetting newfile
381 forgetting newfile
382 forget added file newfile (Yn)? n
382 forget added file newfile (Yn)? n
383 $ hg status
383 $ hg status
384 A newfile
384 A newfile
385 $ hg revert -i <<EOF
385 $ hg revert -i <<EOF
386 > y
386 > y
387 > EOF
387 > EOF
388 forgetting newfile
388 forgetting newfile
389 forget added file newfile (Yn)? y
389 forget added file newfile (Yn)? y
390 $ hg status
390 $ hg status
391 ? newfile
391 ? newfile
392
392
393 When a line without EOL is selected during "revert -i" (issue5651)
393 When a line without EOL is selected during "revert -i" (issue5651)
394
394
395 $ hg init $TESTTMP/revert-i-eol
395 $ hg init $TESTTMP/revert-i-eol
396 $ cd $TESTTMP/revert-i-eol
396 $ cd $TESTTMP/revert-i-eol
397 $ echo 0 > a
397 $ echo 0 > a
398 $ hg ci -qAm 0
398 $ hg ci -qAm 0
399 $ printf 1 >> a
399 $ printf 1 >> a
400 $ hg ci -qAm 1
400 $ hg ci -qAm 1
401 $ cat a
401 $ cat a
402 0
402 0
403 1 (no-eol)
403 1 (no-eol)
404
404
405 $ hg revert -ir'.^' <<EOF
405 $ hg revert -ir'.^' <<EOF
406 > y
406 > y
407 > y
407 > y
408 > EOF
408 > EOF
409 reverting a
409 reverting a
410 diff --git a/a b/a
410 diff --git a/a b/a
411 1 hunks, 1 lines changed
411 1 hunks, 1 lines changed
412 examine changes to 'a'? [Ynesfdaq?] y
412 examine changes to 'a'? [Ynesfdaq?] y
413
413
414 @@ -1,2 +1,1 @@
414 @@ -1,2 +1,1 @@
415 0
415 0
416 -1
416 -1
417 \ No newline at end of file
417 \ No newline at end of file
418 apply this change to 'a'? [Ynesfdaq?] y
418 apply this change to 'a'? [Ynesfdaq?] y
419
419
420 $ cat a
420 $ cat a
421 0
421 0
422
422
423 When specified pattern does not exist, we should exit early (issue5789).
423 When specified pattern does not exist, we should exit early (issue5789).
424
424
425 $ hg files
425 $ hg files
426 a
426 a
427 $ hg rev b
427 $ hg rev b
428 b: no such file in rev b40d1912accf
428 b: no such file in rev b40d1912accf
429 $ hg rev -i b
429 $ hg rev -i b
430 b: no such file in rev b40d1912accf
430 b: no such file in rev b40d1912accf
431
431
432 $ cd ..
432 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now