[PATCH 3 of 5] revert: use actions[...] in all disptable case

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Aug 18 17:30:53 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1407008734 25200
#      Sat Aug 02 12:45:34 2014 -0700
# Node ID e5b148670e440fb57e018eb69e43dcb5585c2015
# Parent  df01b592e5060253f5d85c44b267b643c3ef396b
revert: use actions[...] in all disptable case

1. Special case are not special enough

2. There is two cases where nothing is done and a message is displayed. This
   prepares it.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2464,11 +2464,13 @@ def revert(ui, repo, ctx, parents, *pats
         # action to be actually performed by revert
         # (<list of file>, message>) tuple
         actions = {'revert': ([], _('reverting %s\n')),
                    'add': ([], _('adding %s\n')),
                    'remove': ([], removeforget),
-                   'undelete': ([], _('undeleting %s\n'))}
+                   'undelete': ([], _('undeleting %s\n')),
+                   'noop': None,
+                  }
 
 
         # should we do a backup ?
         backup = not opts.get('no_backup')
         discard = False
@@ -2481,11 +2483,11 @@ def revert(ui, repo, ctx, parents, *pats
             (modified,   actions['revert'],   discard),
             (dsmodified, actions['revert'],   backup),
             (dsadded,    actions['remove'],   backup),
             (removed,    actions['add'],      backup),
             (dsremoved,  actions['undelete'], backup),
-            (clean,      None,                discard),
+            (clean,      actions['noop'],     discard),
             )
 
         for abs, (rel, exact) in sorted(names.items()):
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)


More information about the Mercurial-devel mailing list