##// END OF EJS Templates
revert: fix --interactive on local modification (issue4576)...
Laurent Charignon -
r24475:06cbff46 default
parent child Browse files
Show More
@@ -2810,6 +2810,7 b' def revert(ui, repo, ctx, parents, *pats'
2810 ## filling of the `names` mapping
2810 ## filling of the `names` mapping
2811 # walk dirstate to fill `names`
2811 # walk dirstate to fill `names`
2812
2812
2813 interactive = opts.get('interactive', False)
2813 wctx = repo[None]
2814 wctx = repo[None]
2814 m = scmutil.match(wctx, pats, opts)
2815 m = scmutil.match(wctx, pats, opts)
2815 if not m.always():
2816 if not m.always():
@@ -3031,7 +3032,10 b' def revert(ui, repo, ctx, parents, *pats'
3031 ui.note(_('saving current version of %s as %s\n') %
3032 ui.note(_('saving current version of %s as %s\n') %
3032 (rel, bakname))
3033 (rel, bakname))
3033 if not opts.get('dry_run'):
3034 if not opts.get('dry_run'):
3034 util.rename(target, bakname)
3035 if interactive:
3036 util.copyfile(target, bakname)
3037 else:
3038 util.rename(target, bakname)
3035 if ui.verbose or not exact:
3039 if ui.verbose or not exact:
3036 if not isinstance(msg, basestring):
3040 if not isinstance(msg, basestring):
3037 msg = msg(abs)
3041 msg = msg(abs)
@@ -3044,7 +3048,6 b' def revert(ui, repo, ctx, parents, *pats'
3044 if not opts.get('dry_run'):
3048 if not opts.get('dry_run'):
3045 needdata = ('revert', 'add', 'undelete')
3049 needdata = ('revert', 'add', 'undelete')
3046 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3050 _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
3047 interactive = opts.get('interactive', False)
3048 _performrevert(repo, parents, ctx, actions, interactive)
3051 _performrevert(repo, parents, ctx, actions, interactive)
3049
3052
3050 # get the list of subrepos that must be reverted
3053 # get the list of subrepos that must be reverted
@@ -205,3 +205,53 b' 10 run the same test than 8 from within '
205 4
205 4
206 5
206 5
207 f
207 f
208 $ hg st
209 M f
210 M folder1/g
211 R folder1/i
212 $ hg revert --interactive f << EOF
213 > y
214 > y
215 > n
216 > n
217 > EOF
218 diff -r 59dd6e4ab63a f
219 2 hunks, 2 lines changed
220 examine changes to 'f'? [Ynesfdaq?] y
221
222 @@ -1,5 +1,6 @@
223 +a
224 1
225 2
226 3
227 4
228 5
229 record change 1/2 to 'f'? [Ynesfdaq?] y
230
231 @@ -1,5 +2,6 @@
232 1
233 2
234 3
235 4
236 5
237 +b
238 record change 2/2 to 'f'? [Ynesfdaq?] n
239
240 $ hg st
241 M f
242 M folder1/g
243 R folder1/i
244 ? f.orig
245 $ cat f
246 a
247 1
248 2
249 3
250 4
251 5
252 $ cat f.orig
253 1
254 2
255 3
256 4
257 5
General Comments 0
You need to be logged in to leave comments. Login now