# HG changeset patch # User Jeff Hammel # Date 1378089514 25200 # Node ID 9b69ce4e50a4345c3317dd5f10f677bbdf7c1692 # Parent fed668f5d44f2082f0d4960cf56110d71932c345 stub diff -r fed668f5d44f -r 9b69ce4e50a4 python/patchutils.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/patchutils.py Sun Sep 01 19:38:34 2013 -0700 @@ -0,0 +1,50 @@ + +""" +http://k0s.org/blog/20100821174911 + +Tag -> hg +""" + +# XXX stub + +import subprocess +import which + +def call(*args, **kwargs): + """""" + return subprocess.check_output(*args, **kwargs) + +class ExecuteCommands(object): + + def __init__(self, *commands, **kwargs): + self.commands = commands + self.kwargs = kwargs + + def __call__(self): + for command in self.commands: + yield call(command, **self.kwargs) + +class lsdiff(ExecuteCommands): + commands = ['lsdiff'] + def __call__(self): + output = [] + for retval in ExecuteCommands(self): + raise NotImplementedError + +def hg_root(directory=None): + directory = directory if directory else os.getcwd() + +# CLI + +def main(args=sys.argv[1:]): + parser = optparse.OptionParser() + options, args = parser.parse_args(args) + + # find the root + root = hg_root() + + # get the files + paths = lsdiff(root) + +if __name__ == '__main__': + main()