Mercurial > hg
diff tests/test-revert-interactive.t @ 29498:1b38cfde9530
revert: don't backup if no files reverted in interactive mode (issue4793)
When reverting interactively, we always backup files before prompting the user
to find out if they actually want to revert them. This can create spurious
*.orig files if a user enters an interactive revert session and then doesn't
revert any files. Instead, we should only backup files that are actually being
touched.
author | skarlage <skarlage@fb.com> |
---|---|
date | Thu, 30 Jun 2016 08:38:19 -0700 |
parents | 14eee72c8d52 |
children | 318a24b52eeb |
line wrap: on
line diff
--- a/tests/test-revert-interactive.t Tue Jul 05 07:25:51 2016 +0900 +++ b/tests/test-revert-interactive.t Thu Jun 30 08:38:19 2016 -0700 @@ -134,7 +134,41 @@ abort: user quit [255] - $ rm folder1/g.orig + $ ls folder1/ + g + +Test that a noop revert doesn't do an unecessary backup + $ (echo y; echo n) | hg revert -i -r 2 folder1/g + diff --git a/folder1/g b/folder1/g + 1 hunks, 1 lines changed + examine changes to 'folder1/g'? [Ynesfdaq?] y + + @@ -3,3 +3,4 @@ + 3 + 4 + 5 + +d + revert this change to 'folder1/g'? [Ynesfdaq?] n + + $ ls folder1/ + g + +Test --no-backup + $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g + diff --git a/folder1/g b/folder1/g + 1 hunks, 1 lines changed + examine changes to 'folder1/g'? [Ynesfdaq?] y + + @@ -3,3 +3,4 @@ + 3 + 4 + 5 + +d + revert this change to 'folder1/g'? [Ynesfdaq?] y + + $ ls folder1/ + g + >>> open('folder1/g', 'wb').write("1\n2\n3\n4\n5\nd\n") $ hg update -C 6