Mercurial > hg
comparison tests/test-revert-interactive.t @ 25259:5b05f10c5024
revert: fix edition of newly added file during --interactive
Before this patch: editing hunks of newly added file when performing a revert
--interactive had no effect: the edits were discarded.
After this patch, the edits are taken into account.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 21 May 2015 14:34:24 -0700 |
parents | f37a69ec3f47 |
children | 3f6b54ef4d41 |
comparison
equal
deleted
inserted
replaced
25258:f37a69ec3f47 | 25259:5b05f10c5024 |
---|---|
268 1 | 268 1 |
269 2 | 269 2 |
270 3 | 270 3 |
271 4 | 271 4 |
272 5 | 272 5 |
273 $ rm f.orig | |
274 $ hg update -C . | |
275 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
276 | |
277 Check editing files newly added by a revert | |
278 | |
279 1) Create a dummy editor changing 1 to 42 | |
280 $ cat > $TESTTMP/editor.sh << '__EOF__' | |
281 > cat "$1" | sed "s/1/42/g" > tt | |
282 > mv tt "$1" | |
283 > __EOF__ | |
284 | |
285 2) Remove f | |
286 $ hg rm f | |
287 $ hg commit -m "remove f" | |
288 | |
289 3) Do another commit on top | |
290 $ touch k; hg add k | |
291 $ hg commit -m "add k" | |
292 $ hg st | |
293 | |
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 | |
296 > y | |
297 > e | |
298 > EOF | |
299 adding f | |
300 removing k | |
301 diff --git a/f b/f | |
302 new file mode 100644 | |
303 examine changes to 'f'? [Ynesfdaq?] y | |
304 | |
305 @@ -0,0 +1,7 @@ | |
306 +a | |
307 +1 | |
308 +2 | |
309 +3 | |
310 +4 | |
311 +5 | |
312 +b | |
313 record this change to 'f'? [Ynesfdaq?] e | |
314 | |
315 $ cat f | |
316 a | |
317 42 | |
318 2 | |
319 3 | |
320 4 | |
321 5 | |
322 b |