comparison mercurial/util.py @ 37119:7ccc9b8aca4c

util: mark filtertable as private constant Prepares for porting to utils.*.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Mar 2018 14:38:34 +0900
parents 49d6ba67c93f
children e7b517809ebc
comparison
equal deleted inserted replaced
37118:49d6ba67c93f 37119:7ccc9b8aca4c
1539 if outname: 1539 if outname:
1540 os.unlink(outname) 1540 os.unlink(outname)
1541 except OSError: 1541 except OSError:
1542 pass 1542 pass
1543 1543
1544 filtertable = { 1544 _filtertable = {
1545 'tempfile:': tempfilter, 1545 'tempfile:': tempfilter,
1546 'pipe:': pipefilter, 1546 'pipe:': pipefilter,
1547 } 1547 }
1548 1548
1549 def filter(s, cmd): 1549 def filter(s, cmd):
1550 "filter a string through a command that transforms its input to its output" 1550 "filter a string through a command that transforms its input to its output"
1551 for name, fn in filtertable.iteritems(): 1551 for name, fn in _filtertable.iteritems():
1552 if cmd.startswith(name): 1552 if cmd.startswith(name):
1553 return fn(s, cmd[len(name):].lstrip()) 1553 return fn(s, cmd[len(name):].lstrip())
1554 return pipefilter(s, cmd) 1554 return pipefilter(s, cmd)
1555 1555
1556 def increasingchunks(source, min=1024, max=65536): 1556 def increasingchunks(source, min=1024, max=65536):