[PATCH 1 of 4] revert: small refactoring in the way backup value are handled

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 19 20:05:00 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 c7bf7274d2184c47fa0988f054b24d1b2b3416cd
# Parent  5e16fe6fdd32124c3295db5ec40b076084cc5bd4
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
@@ -2620,12 +2620,14 @@ def revert(ui, repo, ctx, parents, *pats
                    'unknown': (None, _('file not managed: %s\n')),
                   }
 
 
         # should we do a backup?
-        backup = not opts.get('no_backup')
-        discard = False
+        backup = 2
+        discard = 0
+        if opts.get('no_backup'):
+            backup = 0
 
         disptable = (
             # dispatch table:
             #   file state
             #   action


More information about the Mercurial-devel mailing list