##// END OF EJS Templates
revert: makes interactive mode ask to forget added files (issue4936)...
liscju -
r27985:79139c7a default
parent child Browse files
Show More
@@ -3130,12 +3130,25 b' def _performrevert(repo, parents, ctx, a'
3130 """
3130 """
3131 parent, p2 = parents
3131 parent, p2 = parents
3132 node = ctx.node()
3132 node = ctx.node()
3133 excluded_files = []
3134 matcher_opts = {"exclude": excluded_files}
3135
3133 def checkout(f):
3136 def checkout(f):
3134 fc = ctx[f]
3137 fc = ctx[f]
3135 repo.wwrite(f, fc.data(), fc.flags())
3138 repo.wwrite(f, fc.data(), fc.flags())
3136
3139
3137 audit_path = pathutil.pathauditor(repo.root)
3140 audit_path = pathutil.pathauditor(repo.root)
3138 for f in actions['forget'][0]:
3141 for f in actions['forget'][0]:
3142 if interactive:
3143 choice = \
3144 repo.ui.promptchoice(
3145 _("forget added file %s (yn)?$$ &Yes $$ &No")
3146 % f)
3147 if choice == 0:
3148 repo.dirstate.drop(f)
3149 else:
3150 excluded_files.append(repo.wjoin(f))
3151 else:
3139 repo.dirstate.drop(f)
3152 repo.dirstate.drop(f)
3140 for f in actions['remove'][0]:
3153 for f in actions['remove'][0]:
3141 audit_path(f)
3154 audit_path(f)
@@ -3162,7 +3175,7 b' def _performrevert(repo, parents, ctx, a'
3162 if interactive:
3175 if interactive:
3163 # Prompt the user for changes to revert
3176 # Prompt the user for changes to revert
3164 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3177 torevert = [repo.wjoin(f) for f in actions['revert'][0]]
3165 m = scmutil.match(ctx, torevert, {})
3178 m = scmutil.match(ctx, torevert, matcher_opts)
3166 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3179 diffopts = patch.difffeatureopts(repo.ui, whitespace=True)
3167 diffopts.nodates = True
3180 diffopts.nodates = True
3168 diffopts.git = True
3181 diffopts.git = True
@@ -15,6 +15,7 b' 10 run the same test than 8 from within '
15 > interactive = true
15 > interactive = true
16 > [extensions]
16 > [extensions]
17 > record =
17 > record =
18 > purge =
18 > EOF
19 > EOF
19
20
20
21
@@ -377,3 +378,26 b' Check the experimental config to invert '
377 5
378 5
378 d
379 d
379 +lastline
380 +lastline
381
382 $ hg update -C .
383 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
384 $ hg purge
385 $ touch newfile
386 $ hg add newfile
387 $ hg status
388 A newfile
389 $ hg revert -i <<EOF
390 > n
391 > EOF
392 forgetting newfile
393 forget added file newfile (yn)? n
394 $ hg status
395 A newfile
396 $ hg revert -i <<EOF
397 > y
398 > EOF
399 forgetting newfile
400 forget added file newfile (yn)? y
401 $ hg status
402 ? newfile
403
General Comments 0
You need to be logged in to leave comments. Login now