Patchwork D6727: fix: pass line ranges as value instead of callback

login
register
mail settings
Submitter phabricator
Date Aug. 14, 2019, 8:43 p.m.
Message ID <ea50815c136f4659b6acc2e747f1c321@localhost.localdomain>
Download mbox | patch
Permalink /patch/41281/
State Not Applicable
Headers show

Comments

phabricator - Aug. 14, 2019, 8:43 p.m.
Closed by commit rHG64a0cb2d4692: fix: pass line ranges as value instead of callback (authored by hooper).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6727?vs=16194&id=16207

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6727/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6727

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS




To: hooper, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -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