[PATCH 1 of 4 V2] revert: small refactoring in the way backup value are handled
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Sep 30 13:05:37 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1409358507 -7200
# Sat Aug 30 02:28:27 2014 +0200
# Node ID 5ddd515bd5209e36ccc0cc40d9e8436253bc611b
# Parent 4109cc16279ef0e04dc70e7f4c9ab7415e6a22d3
revert: small refactoring in the way backup value are handled
The current backup value may have two different values:
1. Do not try to do backup
2. Do backup if applicable
We are about to move to:
1. Do not try to do backup
2. Do backup if applicable
3. Do backup in all cases
So we change the current values to make room for the new one.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2615,14 +2615,17 @@ def revert(ui, repo, ctx, parents, *pats
'undelete': ([], _('undeleting %s\n')),
'noop': (None, _('no changes needed to %s\n')),
'unknown': (None, _('file not managed: %s\n')),
}
-
- # should we do a backup?
- backup = not opts.get('no_backup')
- discard = False
+ # "constant" that convey the backup strategy.
+ # All set to `discard` if `no-backup` is set do avoid checking
+ # no_backup lower in the code.
+ backup = 2 # unconditionnally do backup
+ discard = 0 # never do backup
+ if opts.get('no_backup'):
+ backup = discard
disptable = (
# dispatch table:
# file state
# action
More information about the Mercurial-devel
mailing list