##// END OF EJS Templates
fix: pass line ranges as value instead of callback...
Danny Hooper -
r43003:e9f50307 default
parent child Browse files
Show More
@@ -563,8 +563,8 b' def fixfile(ui, repo, opts, fixers, fixc'
563 newdata = fixctx[path].data()
563 newdata = fixctx[path].data()
564 for fixername, fixer in fixers.iteritems():
564 for fixername, fixer in fixers.iteritems():
565 if fixer.affects(opts, fixctx, path):
565 if fixer.affects(opts, fixctx, path):
566 rangesfn = lambda: lineranges(opts, path, basectxs, fixctx, newdata)
566 ranges = lineranges(opts, path, basectxs, fixctx, newdata)
567 command = fixer.command(ui, path, rangesfn)
567 command = fixer.command(ui, path, ranges)
568 if command is None:
568 if command is None:
569 continue
569 continue
570 ui.debug('subprocess: %s\n' % (command,))
570 ui.debug('subprocess: %s\n' % (command,))
@@ -758,7 +758,7 b' class Fixer(object):'
758 """Should the stdout of this fixer start with JSON and a null byte?"""
758 """Should the stdout of this fixer start with JSON and a null byte?"""
759 return self._metadata
759 return self._metadata
760
760
761 def command(self, ui, path, rangesfn):
761 def command(self, ui, path, ranges):
762 """A shell command to use to invoke this fixer on the given file/lines
762 """A shell command to use to invoke this fixer on the given file/lines
763
763
764 May return None if there is no appropriate command to run for the given
764 May return None if there is no appropriate command to run for the given
@@ -768,7 +768,6 b' class Fixer(object):'
768 parts = [expand(ui, self._command,
768 parts = [expand(ui, self._command,
769 {'rootpath': path, 'basename': os.path.basename(path)})]
769 {'rootpath': path, 'basename': os.path.basename(path)})]
770 if self._linerange:
770 if self._linerange:
771 ranges = rangesfn()
772 if self._skipclean and not ranges:
771 if self._skipclean and not ranges:
773 # No line ranges to fix, so don't run the fixer.
772 # No line ranges to fix, so don't run the fixer.
774 return None
773 return None
General Comments 0
You need to be logged in to leave comments. Login now