summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/diff-manifest.py
blob: 801733cc69d0d9981fe8273e0b57055695618303 (plain)
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
#!/usr/bin/env python

import difflib
import json
import os
import subprocess
import sys


def call(*args):
    return subprocess.check_output(args)


def get_manifest(rev):
    call("git", "checkout", rev)
    call("./manifest", "-r")
    with open("MANIFEST.json", "r") as fp:
        return fp.readlines()


def main():
    after = get_manifest("HEAD")

    call("git", "fetch", "origin", "master:master")
    merge_base = call("git", "merge-base", "master", "HEAD").strip()
    before = get_manifest(merge_base)

    diff = difflib.unified_diff(before, after,
                                fromfile='before.json', tofile='after.json')
    for line in diff:
        sys.stdout.write(line)


if __name__ == "__main__":
    main()