2
from subprocess import Popen, PIPE
3
def patch(branch, filename, strip):
4
"""Apply a patch to a branch, using patch(1)."""
8
my_file = file(filename, 'rb')
9
cmd = ['patch', '--directory', branch.base, '--strip', str(strip)]
10
child_proc = Popen(cmd, stdin=PIPE)
12
child_proc.stdin.write(line)
13
child_proc.stdin.close()
14
return child_proc.wait()