Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
29497:ee2027195847 | 29498:1b38cfde9530 |
---|---|
132 1 hunks, 1 lines changed | 132 1 hunks, 1 lines changed |
133 examine changes to 'folder1/g'? [Ynesfdaq?] q | 133 examine changes to 'folder1/g'? [Ynesfdaq?] q |
134 | 134 |
135 abort: user quit | 135 abort: user quit |
136 [255] | 136 [255] |
137 $ rm folder1/g.orig | 137 $ ls folder1/ |
138 g | |
139 | |
140 Test that a noop revert doesn't do an unecessary backup | |
141 $ (echo y; echo n) | hg revert -i -r 2 folder1/g | |
142 diff --git a/folder1/g b/folder1/g | |
143 1 hunks, 1 lines changed | |
144 examine changes to 'folder1/g'? [Ynesfdaq?] y | |
145 | |
146 @@ -3,3 +3,4 @@ | |
147 3 | |
148 4 | |
149 5 | |
150 +d | |
151 revert this change to 'folder1/g'? [Ynesfdaq?] n | |
152 | |
153 $ ls folder1/ | |
154 g | |
155 | |
156 Test --no-backup | |
157 $ (echo y; echo y) | hg revert -i -C -r 2 folder1/g | |
158 diff --git a/folder1/g b/folder1/g | |
159 1 hunks, 1 lines changed | |
160 examine changes to 'folder1/g'? [Ynesfdaq?] y | |
161 | |
162 @@ -3,3 +3,4 @@ | |
163 3 | |
164 4 | |
165 5 | |
166 +d | |
167 revert this change to 'folder1/g'? [Ynesfdaq?] y | |
168 | |
169 $ ls folder1/ | |
170 g | |
171 >>> open('folder1/g', 'wb').write("1\n2\n3\n4\n5\nd\n") | |
138 | 172 |
139 | 173 |
140 $ hg update -C 6 | 174 $ hg update -C 6 |
141 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | 175 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
142 $ hg revert -i -r 2 --all -- << EOF | 176 $ hg revert -i -r 2 --all -- << EOF |