def last_updated_date(self): if self.__updated is None: for line in cmd_lines('git', 'log', '-g', '-n', '1', '--date=local', '--pretty=%gd', self.fqn, '--'): m = re.search(r'\{(.*)\}', line) if m: # Thu Nov 27 19:17:23 2014 self.__updated = datetime.strptime(m.group(1), DATE_FORMAT) break printv('branch last updated: branch=', self, ', date=', self.__updated) return self.__updated
def parse_branch(s): if s.startswith(REMOTE_PREFIX): s = s[len(REMOTE_PREFIX):] i = s.index('/') remote = s[:i] name = s[i + 1:] return Branch(name, remote) else: return Branch(s) # build list of branches branches = [] for line in cmd_lines('git', 'branch', '--all'): line = line.strip() # skip empty lines if not line: continue # skip the current branch if line[0] == '*': continue if not re.match(r'[a-zA-Z0-9-\._]+(\/[a-zA-Z0-9-\._]+)*$', line): continue branch = parse_branch(line)
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) for author in authors: write_log_file([author], get_log_file(author), extra_options) print '\n'
def parse_branch(s): if s.startswith(REMOTE_PREFIX): s = s[len(REMOTE_PREFIX):] i = s.index('/') remote = s[:i] name = s[i+1:] return Branch(name, remote) else: return Branch(s) # build list of branches branches = [] for line in cmd_lines('git', 'branch', '--all'): line = line.strip() # skip empty lines if not line: continue # skip the current branch if line[0] == '*': continue if not re.match(r'[a-zA-Z0-9-\._]+(\/[a-zA-Z0-9-\._]+)*$', line): continue branch = parse_branch(line)
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) for author in authors: write_log_file([author], get_log_file(author), extra_options) print "\n"
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): if not line: continue
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): if not line: continue