Show More
@@ -2629,10 +2629,12 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2629 | # "constant" that convey the backup strategy. |
|
2629 | # "constant" that convey the backup strategy. | |
2630 | # All set to `discard` if `no-backup` is set do avoid checking |
|
2630 | # All set to `discard` if `no-backup` is set do avoid checking | |
2631 | # no_backup lower in the code. |
|
2631 | # no_backup lower in the code. | |
|
2632 | # These values are ordered for comparison purposes | |||
2632 | backup = 2 # unconditionally do backup |
|
2633 | backup = 2 # unconditionally do backup | |
|
2634 | check = 1 # check if the existing file differs from target | |||
2633 | discard = 0 # never do backup |
|
2635 | discard = 0 # never do backup | |
2634 | if opts.get('no_backup'): |
|
2636 | if opts.get('no_backup'): | |
2635 | backup = discard |
|
2637 | backup = check = discard | |
2636 |
|
2638 | |||
2637 | disptable = ( |
|
2639 | disptable = ( | |
2638 | # dispatch table: |
|
2640 | # dispatch table: | |
@@ -2656,11 +2658,11 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2656 | # Removed since target, before working copy parent |
|
2658 | # Removed since target, before working copy parent | |
2657 | (removed, actions['add'], discard), |
|
2659 | (removed, actions['add'], discard), | |
2658 | # Same as `removed` but an unknown file exists at the same path |
|
2660 | # Same as `removed` but an unknown file exists at the same path | |
2659 |
(removunk, actions['add'], |
|
2661 | (removunk, actions['add'], check), | |
2660 | # Removed since targe, marked as such in working copy parent |
|
2662 | # Removed since targe, marked as such in working copy parent | |
2661 | (dsremoved, actions['undelete'], discard), |
|
2663 | (dsremoved, actions['undelete'], discard), | |
2662 | # Same as `dsremoved` but an unknown file exists at the same path |
|
2664 | # Same as `dsremoved` but an unknown file exists at the same path | |
2663 |
(dsremovunk, actions['undelete'], |
|
2665 | (dsremovunk, actions['undelete'], check), | |
2664 | ## the following sets does not result in any file changes |
|
2666 | ## the following sets does not result in any file changes | |
2665 | # File with no modification |
|
2667 | # File with no modification | |
2666 | (clean, actions['noop'], discard), |
|
2668 | (clean, actions['noop'], discard), | |
@@ -2683,12 +2685,13 b' def revert(ui, repo, ctx, parents, *pats' | |||||
2683 | continue |
|
2685 | continue | |
2684 | if xlist is not None: |
|
2686 | if xlist is not None: | |
2685 | xlist.append(abs) |
|
2687 | xlist.append(abs) | |
2686 |
if |
|
2688 | if dobackup and (backup <= dobackup | |
2687 | bakname = "%s.orig" % rel |
|
2689 | or wctx[abs].cmp(ctx[abs])): | |
2688 | ui.note(_('saving current version of %s as %s\n') % |
|
2690 | bakname = "%s.orig" % rel | |
2689 | (rel, bakname)) |
|
2691 | ui.note(_('saving current version of %s as %s\n') % | |
2690 | if not opts.get('dry_run'): |
|
2692 | (rel, bakname)) | |
2691 |
|
|
2693 | if not opts.get('dry_run'): | |
|
2694 | util.rename(target, bakname) | |||
2692 | if ui.verbose or not exact: |
|
2695 | if ui.verbose or not exact: | |
2693 | if not isinstance(msg, basestring): |
|
2696 | if not isinstance(msg, basestring): | |
2694 | msg = msg(abs) |
|
2697 | msg = msg(abs) |
General Comments 0
You need to be logged in to leave comments.
Login now