changeset 22608:bf0ecb224316

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sat, 30 Aug 2014 02:28:27 +0200
parents 4a00110fd870
children 3760ebf786b8
files mercurial/cmdutil.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Oct 01 15:05:09 2014 -0500
+++ b/mercurial/cmdutil.py	Sat Aug 30 02:28:27 2014 +0200
@@ -2626,10 +2626,13 @@
                    '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  # unconditionally do backup
+        discard = 0 # never do backup
+        if opts.get('no_backup'):
+            backup = discard
 
         disptable = (
             # dispatch table: