base_ref = args.revision g = subprocess.Popen(["git", "ls-tree", "-r", base_ref, "--name-only", "menu"], stdout=subprocess.PIPE, encoding="utf-8") flist, _ = g.communicate() for fn in flist.splitlines(): g = subprocess.Popen(["git", "show", "%s:%s" % (base_ref, fn)], stdout=subprocess.PIPE, encoding="utf-8") all[fn] = json.load(g.stdout)