mercurial/util.py
changeset 37116 7ccc9b8aca4c
parent 37115 49d6ba67c93f
child 37117 e7b517809ebc
equal deleted inserted replaced
37115:49d6ba67c93f 37116: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):