diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2013-03-30 00:53:58 +0100 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2013-03-30 01:06:36 +0100 |
commit | 44706a520f6527c67e7f8b741812f11464babda2 (patch) | |
tree | ceba8de9f18d05fea9bb4d337391ed79a2bc7cf4 /lib | |
parent | 5bf870f42dc0cf3e31522e05119c0a8f993a280e (diff) |
split patches
This splits all patches into per-file patches. I've added the little
tool I wrote as well (but it's hard to use).
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/splitpatch.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/splitpatch.py b/lib/splitpatch.py new file mode 100755 index 00000000..09e5814d --- /dev/null +++ b/lib/splitpatch.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import patch, sys + +ps = patch.fromfile(sys.argv[1]) +f = open('INFO', 'w') +f.write(''.join(ps.items[0].header)) +f.close() + +for p in ps.items: + s = p.source[2:].replace('/', '_') + f = open(s, 'w') + f.write('--- %s\n' % p.source) + f.write('+++ %s\n' % p.target) + for h in p.hunks: + f.write('@@ -%d,%d +%d,%d @@\n' % ( + h.startsrc, h.linessrc, + h.starttgt, h.linestgt)) + f.write(''.join(h.text)) + f.close() |