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