##// END OF EJS Templates
test-revert-interactive: don't escape the $ for $TESTTMP...
Matt Harbison -
r25298:3f6b54ef default
parent child Browse files
Show More
@@ -1,322 +1,322 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 > EOF
18 > EOF
19
19
20
20
21 $ mkdir -p a/folder1 a/folder2
21 $ mkdir -p a/folder1 a/folder2
22 $ cd a
22 $ cd a
23 $ hg init
23 $ hg init
24 >>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
24 >>> open('f', 'wb').write("1\n2\n3\n4\n5\n")
25 $ hg add f ; hg commit -m "adding f"
25 $ hg add f ; hg commit -m "adding f"
26 $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
26 $ cat f > folder1/g ; hg add folder1/g ; hg commit -m "adding folder1/g"
27 $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
27 $ cat f > folder2/h ; hg add folder2/h ; hg commit -m "adding folder2/h"
28 $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
28 $ cat f > folder1/i ; hg add folder1/i ; hg commit -m "adding folder1/i"
29 >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
29 >>> open('f', 'wb').write("a\n1\n2\n3\n4\n5\nb\n")
30 $ hg commit -m "modifying f"
30 $ hg commit -m "modifying f"
31 >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
31 >>> open('folder1/g', 'wb').write("c\n1\n2\n3\n4\n5\nd\n")
32 $ hg commit -m "modifying folder1/g"
32 $ hg commit -m "modifying folder1/g"
33 >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
33 >>> open('folder2/h', 'wb').write("e\n1\n2\n3\n4\n5\nf\n")
34 $ hg commit -m "modifying folder2/h"
34 $ hg commit -m "modifying folder2/h"
35 $ hg tip
35 $ hg tip
36 changeset: 6:59dd6e4ab63a
36 changeset: 6:59dd6e4ab63a
37 tag: tip
37 tag: tip
38 user: test
38 user: test
39 date: Thu Jan 01 00:00:00 1970 +0000
39 date: Thu Jan 01 00:00:00 1970 +0000
40 summary: modifying folder2/h
40 summary: modifying folder2/h
41
41
42 $ hg revert -i -r 2 --all -- << EOF
42 $ hg revert -i -r 2 --all -- << EOF
43 > y
43 > y
44 > y
44 > y
45 > y
45 > y
46 > y
46 > y
47 > y
47 > y
48 > n
48 > n
49 > n
49 > n
50 > EOF
50 > EOF
51 reverting f
51 reverting f
52 reverting folder1/g (glob)
52 reverting folder1/g (glob)
53 removing folder1/i (glob)
53 removing folder1/i (glob)
54 reverting folder2/h (glob)
54 reverting folder2/h (glob)
55 diff --git a/f b/f
55 diff --git a/f b/f
56 2 hunks, 2 lines changed
56 2 hunks, 2 lines changed
57 examine changes to 'f'? [Ynesfdaq?] y
57 examine changes to 'f'? [Ynesfdaq?] y
58
58
59 @@ -1,6 +1,5 @@
59 @@ -1,6 +1,5 @@
60 -a
60 -a
61 1
61 1
62 2
62 2
63 3
63 3
64 4
64 4
65 5
65 5
66 record change 1/6 to 'f'? [Ynesfdaq?] y
66 record change 1/6 to 'f'? [Ynesfdaq?] y
67
67
68 @@ -2,6 +1,5 @@
68 @@ -2,6 +1,5 @@
69 1
69 1
70 2
70 2
71 3
71 3
72 4
72 4
73 5
73 5
74 -b
74 -b
75 record change 2/6 to 'f'? [Ynesfdaq?] y
75 record change 2/6 to 'f'? [Ynesfdaq?] y
76
76
77 diff --git a/folder1/g b/folder1/g
77 diff --git a/folder1/g b/folder1/g
78 2 hunks, 2 lines changed
78 2 hunks, 2 lines changed
79 examine changes to 'folder1/g'? [Ynesfdaq?] y
79 examine changes to 'folder1/g'? [Ynesfdaq?] y
80
80
81 @@ -1,6 +1,5 @@
81 @@ -1,6 +1,5 @@
82 -c
82 -c
83 1
83 1
84 2
84 2
85 3
85 3
86 4
86 4
87 5
87 5
88 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
88 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
89
89
90 @@ -2,6 +1,5 @@
90 @@ -2,6 +1,5 @@
91 1
91 1
92 2
92 2
93 3
93 3
94 4
94 4
95 5
95 5
96 -d
96 -d
97 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
97 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
98
98
99 diff --git a/folder2/h b/folder2/h
99 diff --git a/folder2/h b/folder2/h
100 2 hunks, 2 lines changed
100 2 hunks, 2 lines changed
101 examine changes to 'folder2/h'? [Ynesfdaq?] n
101 examine changes to 'folder2/h'? [Ynesfdaq?] n
102
102
103 $ cat f
103 $ cat f
104 1
104 1
105 2
105 2
106 3
106 3
107 4
107 4
108 5
108 5
109 $ cat folder1/g
109 $ cat folder1/g
110 1
110 1
111 2
111 2
112 3
112 3
113 4
113 4
114 5
114 5
115 d
115 d
116 $ cat folder2/h
116 $ cat folder2/h
117 e
117 e
118 1
118 1
119 2
119 2
120 3
120 3
121 4
121 4
122 5
122 5
123 f
123 f
124
124
125 Test that --interactive lift the need for --all
125 Test that --interactive lift the need for --all
126
126
127 $ echo q | hg revert -i -r 2
127 $ echo q | hg revert -i -r 2
128 reverting folder1/g (glob)
128 reverting folder1/g (glob)
129 reverting folder2/h (glob)
129 reverting folder2/h (glob)
130 diff --git a/folder1/g b/folder1/g
130 diff --git a/folder1/g b/folder1/g
131 1 hunks, 1 lines changed
131 1 hunks, 1 lines changed
132 examine changes to 'folder1/g'? [Ynesfdaq?] q
132 examine changes to 'folder1/g'? [Ynesfdaq?] q
133
133
134 abort: user quit
134 abort: user quit
135 [255]
135 [255]
136 $ rm folder1/g.orig
136 $ rm folder1/g.orig
137
137
138
138
139 $ hg update -C 6
139 $ hg update -C 6
140 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 $ hg revert -i -r 2 --all -- << EOF
141 $ hg revert -i -r 2 --all -- << EOF
142 > y
142 > y
143 > y
143 > y
144 > y
144 > y
145 > y
145 > y
146 > y
146 > y
147 > n
147 > n
148 > n
148 > n
149 > EOF
149 > EOF
150 reverting f
150 reverting f
151 reverting folder1/g (glob)
151 reverting folder1/g (glob)
152 removing folder1/i (glob)
152 removing folder1/i (glob)
153 reverting folder2/h (glob)
153 reverting folder2/h (glob)
154 diff --git a/f b/f
154 diff --git a/f b/f
155 2 hunks, 2 lines changed
155 2 hunks, 2 lines changed
156 examine changes to 'f'? [Ynesfdaq?] y
156 examine changes to 'f'? [Ynesfdaq?] y
157
157
158 @@ -1,6 +1,5 @@
158 @@ -1,6 +1,5 @@
159 -a
159 -a
160 1
160 1
161 2
161 2
162 3
162 3
163 4
163 4
164 5
164 5
165 record change 1/6 to 'f'? [Ynesfdaq?] y
165 record change 1/6 to 'f'? [Ynesfdaq?] y
166
166
167 @@ -2,6 +1,5 @@
167 @@ -2,6 +1,5 @@
168 1
168 1
169 2
169 2
170 3
170 3
171 4
171 4
172 5
172 5
173 -b
173 -b
174 record change 2/6 to 'f'? [Ynesfdaq?] y
174 record change 2/6 to 'f'? [Ynesfdaq?] y
175
175
176 diff --git a/folder1/g b/folder1/g
176 diff --git a/folder1/g b/folder1/g
177 2 hunks, 2 lines changed
177 2 hunks, 2 lines changed
178 examine changes to 'folder1/g'? [Ynesfdaq?] y
178 examine changes to 'folder1/g'? [Ynesfdaq?] y
179
179
180 @@ -1,6 +1,5 @@
180 @@ -1,6 +1,5 @@
181 -c
181 -c
182 1
182 1
183 2
183 2
184 3
184 3
185 4
185 4
186 5
186 5
187 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
187 record change 3/6 to 'folder1/g'? [Ynesfdaq?] y
188
188
189 @@ -2,6 +1,5 @@
189 @@ -2,6 +1,5 @@
190 1
190 1
191 2
191 2
192 3
192 3
193 4
193 4
194 5
194 5
195 -d
195 -d
196 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
196 record change 4/6 to 'folder1/g'? [Ynesfdaq?] n
197
197
198 diff --git a/folder2/h b/folder2/h
198 diff --git a/folder2/h b/folder2/h
199 2 hunks, 2 lines changed
199 2 hunks, 2 lines changed
200 examine changes to 'folder2/h'? [Ynesfdaq?] n
200 examine changes to 'folder2/h'? [Ynesfdaq?] n
201
201
202 $ cat f
202 $ cat f
203 1
203 1
204 2
204 2
205 3
205 3
206 4
206 4
207 5
207 5
208 $ cat folder1/g
208 $ cat folder1/g
209 1
209 1
210 2
210 2
211 3
211 3
212 4
212 4
213 5
213 5
214 d
214 d
215 $ cat folder2/h
215 $ cat folder2/h
216 e
216 e
217 1
217 1
218 2
218 2
219 3
219 3
220 4
220 4
221 5
221 5
222 f
222 f
223 $ hg st
223 $ hg st
224 M f
224 M f
225 M folder1/g
225 M folder1/g
226 R folder1/i
226 R folder1/i
227 $ hg revert --interactive f << EOF
227 $ hg revert --interactive f << EOF
228 > y
228 > y
229 > y
229 > y
230 > n
230 > n
231 > n
231 > n
232 > EOF
232 > EOF
233 diff --git a/f b/f
233 diff --git a/f b/f
234 2 hunks, 2 lines changed
234 2 hunks, 2 lines changed
235 examine changes to 'f'? [Ynesfdaq?] y
235 examine changes to 'f'? [Ynesfdaq?] y
236
236
237 @@ -1,5 +1,6 @@
237 @@ -1,5 +1,6 @@
238 +a
238 +a
239 1
239 1
240 2
240 2
241 3
241 3
242 4
242 4
243 5
243 5
244 record change 1/2 to 'f'? [Ynesfdaq?] y
244 record change 1/2 to 'f'? [Ynesfdaq?] y
245
245
246 @@ -1,5 +2,6 @@
246 @@ -1,5 +2,6 @@
247 1
247 1
248 2
248 2
249 3
249 3
250 4
250 4
251 5
251 5
252 +b
252 +b
253 record change 2/2 to 'f'? [Ynesfdaq?] n
253 record change 2/2 to 'f'? [Ynesfdaq?] n
254
254
255 $ hg st
255 $ hg st
256 M f
256 M f
257 M folder1/g
257 M folder1/g
258 R folder1/i
258 R folder1/i
259 ? f.orig
259 ? f.orig
260 $ cat f
260 $ cat f
261 a
261 a
262 1
262 1
263 2
263 2
264 3
264 3
265 4
265 4
266 5
266 5
267 $ cat f.orig
267 $ cat f.orig
268 1
268 1
269 2
269 2
270 3
270 3
271 4
271 4
272 5
272 5
273 $ rm f.orig
273 $ rm f.orig
274 $ hg update -C .
274 $ hg update -C .
275 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
276
276
277 Check editing files newly added by a revert
277 Check editing files newly added by a revert
278
278
279 1) Create a dummy editor changing 1 to 42
279 1) Create a dummy editor changing 1 to 42
280 $ cat > $TESTTMP/editor.sh << '__EOF__'
280 $ cat > $TESTTMP/editor.sh << '__EOF__'
281 > cat "$1" | sed "s/1/42/g" > tt
281 > cat "$1" | sed "s/1/42/g" > tt
282 > mv tt "$1"
282 > mv tt "$1"
283 > __EOF__
283 > __EOF__
284
284
285 2) Remove f
285 2) Remove f
286 $ hg rm f
286 $ hg rm f
287 $ hg commit -m "remove f"
287 $ hg commit -m "remove f"
288
288
289 3) Do another commit on top
289 3) Do another commit on top
290 $ touch k; hg add k
290 $ touch k; hg add k
291 $ hg commit -m "add k"
291 $ hg commit -m "add k"
292 $ hg st
292 $ hg st
293
293
294 4) Use interactive revert to recover f and change it on the fly
294 4) Use interactive revert to recover f and change it on the fly
295 $ HGEDITOR="\"sh\" \"\${TESTTMP}/editor.sh\"" PRINTHUNK="YES" hg revert -i -r ".^^" <<EOF
295 $ HGEDITOR="\"sh\" \"${TESTTMP}/editor.sh\"" PRINTHUNK="YES" hg revert -i -r ".^^" <<EOF
296 > y
296 > y
297 > e
297 > e
298 > EOF
298 > EOF
299 adding f
299 adding f
300 removing k
300 removing k
301 diff --git a/f b/f
301 diff --git a/f b/f
302 new file mode 100644
302 new file mode 100644
303 examine changes to 'f'? [Ynesfdaq?] y
303 examine changes to 'f'? [Ynesfdaq?] y
304
304
305 @@ -0,0 +1,7 @@
305 @@ -0,0 +1,7 @@
306 +a
306 +a
307 +1
307 +1
308 +2
308 +2
309 +3
309 +3
310 +4
310 +4
311 +5
311 +5
312 +b
312 +b
313 record this change to 'f'? [Ynesfdaq?] e
313 record this change to 'f'? [Ynesfdaq?] e
314
314
315 $ cat f
315 $ cat f
316 a
316 a
317 42
317 42
318 2
318 2
319 3
319 3
320 4
320 4
321 5
321 5
322 b
322 b
General Comments 0
You need to be logged in to leave comments. Login now