revert: inline a now useless closure
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 24 Jun 2014 17:39:43 +0100
changeset 22212 f18aca03ddd9
parent 22211 76fa261b5fe3
child 22213 f1debbcd71cd
revert: inline a now useless closure Now that a single call site remains, we can just inline its content.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Tue Jun 24 17:37:24 2014 +0100
+++ b/mercurial/cmdutil.py	Tue Jun 24 17:39:43 2014 +0100
@@ -2484,7 +2484,16 @@
         for abs, (rel, exact) in sorted(names.items()):
             # target file to be touch on disk (relative to cwd)
             target = repo.wjoin(abs)
-            def handle(xlist, dobackup):
+            # search the entry in the dispatch table.
+            # if the file is in any of these sets, it was touched in the working
+            # directory parent and we are sure it needs to be reverted.
+            for table, (xlist, 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)
                 if (dobackup and not opts.get('no_backup') and
                     os.path.lexists(target) and
@@ -2499,18 +2508,6 @@
                     if not isinstance(msg, basestring):
                         msg = msg(abs)
                     ui.status(msg % rel)
-            # 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, (action, backup) in disptable:
-                if abs not in table:
-                    continue
-                if action is None:
-                    if exact:
-                        ui.warn(_('no changes needed to %s\n') % rel)
-
-                else:
-                    handle(action, backup)
                 break
             else:
                 # Not touched in current dirstate.