##// END OF EJS Templates
fix: compute changed lines lazily to make whole-file fixer tools faster...
Danny Hooper -
r38896:257c9846 default
parent child Browse files
Show More
@@ -436,8 +436,8 b' def fixfile(ui, opts, fixers, fixctx, pa'
436 436 newdata = fixctx[path].data()
437 437 for fixername, fixer in fixers.iteritems():
438 438 if fixer.affects(opts, fixctx, path):
439 ranges = lineranges(opts, path, basectxs, fixctx, newdata)
440 command = fixer.command(ui, path, ranges)
439 rangesfn = lambda: lineranges(opts, path, basectxs, fixctx, newdata)
440 command = fixer.command(ui, path, rangesfn)
441 441 if command is None:
442 442 continue
443 443 ui.debug('subprocess: %s\n' % (command,))
@@ -582,7 +582,7 b' class Fixer(object):'
582 582 """Should this fixer run on the file at the given path and context?"""
583 583 return scmutil.match(fixctx, [self._fileset], opts)(path)
584 584
585 def command(self, ui, path, ranges):
585 def command(self, ui, path, rangesfn):
586 586 """A shell command to use to invoke this fixer on the given file/lines
587 587
588 588 May return None if there is no appropriate command to run for the given
@@ -592,6 +592,7 b' class Fixer(object):'
592 592 parts = [expand(ui, self._command,
593 593 {'rootpath': path, 'basename': os.path.basename(path)})]
594 594 if self._linerange:
595 ranges = rangesfn()
595 596 if not ranges:
596 597 # No line ranges to fix, so don't run the fixer.
597 598 return None
General Comments 0
You need to be logged in to leave comments. Login now