open(filename, 'w').write( subprocess.check_output(args, stderr=subprocess.STDOUT) ) print filename extra_options = [] if options.git_log_options: extra_options = shlex.split(options.git_log_options) print 'Author commits logged to these files:\n' if options.groups_path: groups = load_author_groups(options.groups_path) for group_name, authors in groups.items(): write_log_file(authors, get_log_file(group_name), extra_options) else: authors = set() for line in cmd_lines(*(['git', 'log', '--format=%aE'] + extra_options)): line = line.strip() if not line: continue authors.add(line)
metavar='DIR', help='exclude the given path filter', action='append', ) return parser.parse_args() (options, args) = parse_command_line() import subprocess import re import fnmatch from git_helpers import cmd_lines, load_author_groups groups = load_author_groups( options.groups_path) if options.groups_path else dict() line_counts = dict() for filename in cmd_lines('git', 'ls-tree', '-r', '--name-only', 'HEAD'): if not filename: continue if any(fnmatch.fnmatch(filename, f) for f in options.exclude_filters): continue print filename try: for line in cmd_lines('git', 'blame', '-e', 'HEAD', filename):
def write_log_file(authors, filename, extra_options=[]): args = ["git", "log"] + ["--author=" + author for author in authors] + extra_options open(filename, "w").write(subprocess.check_output(args, stderr=subprocess.STDOUT)) print filename extra_options = [] if options.git_log_options: extra_options = shlex.split(options.git_log_options) print "Author commits logged to these files:\n" if options.groups_path: groups = load_author_groups(options.groups_path) for group_name, authors in groups.items(): write_log_file(authors, get_log_file(group_name), extra_options) else: authors = set() for line in cmd_lines(*(["git", "log", "--format=%aE"] + extra_options)): line = line.strip() if not line: continue authors.add(line)
action='append', ) return parser.parse_args() (options, args) = parse_command_line() import subprocess import re import fnmatch from git_helpers import cmd_lines, load_author_groups groups = load_author_groups(options.groups_path) if options.groups_path else dict() line_counts = dict() for filename in cmd_lines('git', 'ls-tree', '-r', '--name-only', 'HEAD'): if not filename: continue if any(fnmatch.fnmatch(filename, f) for f in options.exclude_filters): continue print filename try: for line in cmd_lines('git', 'blame', '-e', 'HEAD', filename):