File: xcontribs.py

package info (click to toggle)
xxdiff 1%3A4.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,716 kB
  • ctags: 2,245
  • sloc: cpp: 18,495; python: 6,134; sh: 1,543; ansic: 1,535; perl: 308; lex: 284; yacc: 279; lisp: 250; tcl: 213; makefile: 82
file content (46 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
"""
A quick script to extract the diffs of contributions from other people, to be
able to review them quickly.
"""

import re
from subprocess import *



def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    opts, args = parser.parse_args()

    fn, = args
    revs = []
    for line in open(fn).xreadlines():
        mo = re.match('^changeset:[ \t]+([0-9]+):', line)
        if not mo:
            continue
        revs.append(int(mo.group(1)))

    files = set()
    for rev in revs:
        p = Popen('hg diff -r %s' % rev, stdout=PIPE, shell=1)
        out, _ = p.communicate()
        print
        print
        print rev
        print
        print out
        ## mo = re.search('files:(.*)\n', out)
        ## files |= set(mo.group(1).split())
        
    print files
    for fn in sorted(files):
        print fn





if __name__ == '__main__':
    main()