blob: aa93d90e63133cdeda3259ed19b3d0af6eb83ce3 [file] [log] [blame]
piman@chromium.orgf43d0192010-04-15 02:36:04 +00001#!/usr/bin/env python
2# Copyright (c) 2010 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Display log of checkins of one particular developer since a particular
7date. Only works on git dependencies at the moment."""
8
Raul Tambre80ee78e2019-05-06 22:41:05 +00009from __future__ import print_function
10
piman@chromium.orgf43d0192010-04-15 02:36:04 +000011import gclient_utils
12import optparse
13import os
14import re
15import subprocess
16import sys
17
18
19def show_log(path, authors, since='1 week ago'):
20 """Display log in a single git repo."""
21
22 author_option = ' '.join(['--author=' + author for author in authors])
23 command = ' '.join(['git log', author_option, '--since="%s"' % since,
24 'origin/master', '| git shortlog'])
25 status = subprocess.Popen(['sh', '-c', command],
26 cwd=path,
27 stdout=subprocess.PIPE).communicate()[0].rstrip()
28
29 if len(status.splitlines()) > 0:
Raul Tambre80ee78e2019-05-06 22:41:05 +000030 print('---------- %s ----------' % path)
31 print(status)
piman@chromium.orgf43d0192010-04-15 02:36:04 +000032
33
34def main():
35 """Take no arguments."""
36
37 option_parser = optparse.OptionParser()
38 option_parser.add_option("-a", "--author", action="append", default=[])
39 option_parser.add_option("-s", "--since", default="1 week ago")
40 options, args = option_parser.parse_args()
41
42 root, entries = gclient_utils.GetGClientRootAndEntries()
43
44 # which entries map to a git repos?
45 paths = [k for k, v in entries.items() if not re.search('svn', v)]
46 paths.sort()
47
48 for path in paths:
49 dir = os.path.normpath(os.path.join(root, path))
50 show_log(dir, options.author, options.since)
51
52
53if __name__ == '__main__':
54 main()