weekly 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/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. """Display log of checkins of one particular developer since a particular
  6. date. Only works on git dependencies at the moment."""
  7. from __future__ import print_function
  8. import gclient_utils
  9. import optparse
  10. import os
  11. import re
  12. import subprocess
  13. import sys
  14. def show_log(path, authors, since='1 week ago'):
  15. """Display log in a single git repo."""
  16. author_option = ' '.join(['--author=' + author for author in authors])
  17. command = ' '.join(['git log', author_option, '--since="%s"' % since,
  18. 'origin/master', '| git shortlog'])
  19. status = subprocess.Popen(['sh', '-c', command],
  20. cwd=path,
  21. stdout=subprocess.PIPE).communicate()[0].rstrip()
  22. if len(status.splitlines()) > 0:
  23. print('---------- %s ----------' % path)
  24. print(status)
  25. def main():
  26. """Take no arguments."""
  27. option_parser = optparse.OptionParser()
  28. option_parser.add_option("-a", "--author", action="append", default=[])
  29. option_parser.add_option("-s", "--since", default="1 week ago")
  30. options, args = option_parser.parse_args()
  31. root, entries = gclient_utils.GetGClientRootAndEntries()
  32. # which entries map to a git repos?
  33. paths = [k for k, v in entries.items() if not re.search('svn', v)]
  34. paths.sort()
  35. for path in paths:
  36. dir = os.path.normpath(os.path.join(root, path))
  37. show_log(dir, options.author, options.since)
  38. if __name__ == '__main__':
  39. main()