hgext/fix.py
changeset 42758 e9f503074044
parent 42757 2d70b1118af2
child 43058 808a57a08470
--- a/hgext/fix.py	Tue Aug 13 14:20:48 2019 -0700
+++ b/hgext/fix.py	Tue Aug 13 14:28:10 2019 -0700
@@ -563,8 +563,8 @@
     newdata = fixctx[path].data()
     for fixername, fixer in fixers.iteritems():
         if fixer.affects(opts, fixctx, path):
-            rangesfn = lambda: lineranges(opts, path, basectxs, fixctx, newdata)
-            command = fixer.command(ui, path, rangesfn)
+            ranges = lineranges(opts, path, basectxs, fixctx, newdata)
+            command = fixer.command(ui, path, ranges)
             if command is None:
                 continue
             ui.debug('subprocess: %s\n' % (command,))
@@ -758,7 +758,7 @@
         """Should the stdout of this fixer start with JSON and a null byte?"""
         return self._metadata
 
-    def command(self, ui, path, rangesfn):
+    def command(self, ui, path, ranges):
         """A shell command to use to invoke this fixer on the given file/lines
 
         May return None if there is no appropriate command to run for the given
@@ -768,7 +768,6 @@
         parts = [expand(ui, self._command,
                         {'rootpath': path, 'basename': os.path.basename(path)})]
         if self._linerange:
-            ranges = rangesfn()
             if self._skipclean and not ranges:
                 # No line ranges to fix, so don't run the fixer.
                 return None