Quoting Anton Khirnov (2016-01-02 19:27:58)
> I'm afraid still nothing interesting to see here.

To make reviewing this less painful, I wrote a very naive script
(attached) that will highlight the interesting parts for you, or tell
you there are none.

-- 
Anton Khirnov
#!/usr/bin/python

import re
import sys

adds = []
deletes = []
deletes_unmatched = []
lines = []

pattern = sys.argv[2]
replacement = sys.argv[3]

with open(sys.argv[1], 'r') as f:
    for line in f:
        line = line.rstrip('\n')
        line = re.sub(' +', ' ', line)
        if line.startswith('-') and not line.startswith('--'):
            deletes.append(line[1:])
        if line.startswith('+') and not line.startswith('+++'):
            adds.append(line[1:])
        lines.append(line)

for i, d in enumerate(deletes):
    new_line = re.sub(pattern, replacement, d)

    matched = False
    for j, a in enumerate(adds):
        if new_line == a:
            matched = True
            del adds[j]
            break
    if not matched:
        deletes_unmatched.append(d)

if len(deletes_unmatched) > 0 or len(adds) > 0:
    for l in lines:
        if len(l) > 0 and l[1:] in deletes_unmatched:
            sys.stdout.write('<< %s' % l)
        elif len(l) > 0 and l[1:] in adds:
            sys.stdout.write('>> %s' % l)
        else:
            sys.stdout.write(l)
        sys.stdout.write('\n')
else:
    sys.stdout.write('all matched\n')
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to