revert: small refactoring in the way backup value are handled
authorPierre-Yves David <pierre-yves.david@fb.com>
Sat, 30 Aug 2014 02:28:27 +0200
changeset 22608 bf0ecb224316
parent 22607 4a00110fd870
child 22609 3760ebf786b8
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.
mercurial/cmdutil.py
--- 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: