[PATCH 4 of 5] revert: explode the action tuple in the for loop

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1403629453 -3600
#      Tue Jun 24 18:04:13 2014 +0100
# Node ID e53ef14e9147149b9522ac32d603ef55d636ae4b
# Parent  e5b148670e440fb57e018eb69e43dcb5585c2015
revert: explode the action tuple in the for loop

noop is about to gain a message.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2465,11 +2465,11 @@ def revert(ui, repo, ctx, parents, *pats
         # (<list of file>, message>) tuple
         actions = {'revert': ([], _('reverting %s\n')),
                    'add': ([], _('adding %s\n')),
                    'remove': ([], removeforget),
                    'undelete': ([], _('undeleting %s\n')),
-                   'noop': None,
+                   'noop': (None, None),
                   }
 
 
         # should we do a backup ?
         backup = not opts.get('no_backup')
@@ -2492,27 +2492,26 @@ def revert(ui, repo, ctx, parents, *pats
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)
             # search the entry in the dispatch table.
             # if the file is in any of this sets, it was touched in the working
             # directory parent and we are sure it needs to be reverted.
-            for table, xlist, dobackup in disptable:
+            for table, (xlist, msg), dobackup in disptable:
                 if abs not in table:
                     continue
                 if xlist is None:
                     if exact:
                         ui.warn(_('no changes needed to %s\n') % rel)
                     break
-                xlist[0].append(abs)
+                xlist.append(abs)
                 if (dobackup and os.path.lexists(target) and
                     abs in ctx and repo[None][abs].cmp(ctx[abs])):
                     bakname = "%s.orig" % rel
                     ui.note(_('saving current version of %s as %s\n') %
                             (rel, bakname))
                     if not opts.get('dry_run'):
                         util.rename(target, bakname)
                 if ui.verbose or not exact:
-                    msg = xlist[1]
                     if not isinstance(msg, basestring):
                         msg = msg(abs)
                     ui.status(msg % rel)
                 break
             else:


More information about the Mercurial-devel mailing list