0

对于创建有关周末工作的统计数据,您有什么建议?

我尝试了一些工具,我最喜欢 git timecard,但我有一个问题:在后台它使用 git log,我收到这个警告:“警告:'...' 的日志只回到星期六, 2015 年 8 月 1 日 01:29:32 +0200' 。

我已经尝试解决这个问题但没有成功。我找到了 git log 的 --full-history 开关,但这并没有帮助。

提前感谢您的帮助!

4

2 回答 2

0

对于 linux、windows (with wsl) 或 macos,您可以使用 gitstats,安装可在此处找到

https://flossexperiences.wordpress.com/2015/10/03/gitstats-the-easyest-way-to-see-stats/

用途是

gitstats . ../projectStatsDirectory

然后转到 projectStatsDirectory 并查看 index.html

于 2019-12-19T09:32:14.083 回答
-1

我对一些不在 GitHub 上的商业项目也有类似的问题。我不需要关于我的存储库的大量统计信息,只需要一个简单的答案 - 你有多少活跃的提交天数。所以我写了一个简单的脚本来为我做这件事 - https://github.com/aerkalov/sabbath

#!/usr/bin/env python

from __future__ import print_function

import datetime
import collections
import argparse
import sys


DAYS_OF_WEEK = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
MIN_SATURDAY = 1
MIN_SUNDAY = 1

weekdays = collections.Counter()
dates = []
total = 0


def parse_stdin():
    global dates
    global total

    for line in sys.stdin:
        date = line.strip().split(' ')[3]

        if date not in dates:
            dates.append(date)
            # yes :)
            d2 = date.split('-')
            d = datetime.datetime(int(d2[0]), int(d2[1]), int(d2[2]))
            weekdays[d.weekday()] += 1
            total += 1


def show_report(use_colours):
    print('\nRemember the sabbath day')
    print('-' * 80)

    for days in range(7):
        num = weekdays[days]
        try:
            per = float(num) / float(total) * 100
        except ZeroDivisionError:
            per = 0

        colour_start, colour_end = '', ''

        if use_colours:
            colour_start, colour_end = '\033[32m', '\033[0m'

            if days >= 5:
                if days == 5 and num > MIN_SATURDAY:
                    colour_start = '\033[31m'
                if days == 6 and num > MIN_SUNDAY:
                    colour_start = '\033[31m'

        print('{day:>10} : {cs}{percent:>2} %{ce} : {cs}{graph}{ce}'.format(
            day=DAYS_OF_WEEK[days],
            cs=colour_start,
            ce=colour_end,
            percent=int(round(per)),
            graph='#' * int(per)
        ))
    print('-' * 80)


if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='''Check how much do you work on weekends.
  https://github.com/aerkalov/sabbath''',
        epilog='''Usage:
  $ git log --date=short | grep "^Date:" | sabbath.py -s -c
  $ git log --date=short --since="2013-01-01" | grep "^Date:" | sabbath.py -s

  $ git log --date=short --author=Erkal | grep "^Date:" | sabbath.py -5
  $ echo $?
  ''',
        formatter_class=argparse.RawTextHelpFormatter)

    parser.add_argument('-s', '--show', action='store_true', default=False, dest='show', help='Show Git activity.')
    parser.add_argument('-5', '--have-i-sinned', action='store_true', default=False, dest='sinner', help='Are you a sinner?')
    parser.add_argument('-c', '--colour', action='store_true', default=False, dest='colour', help='Use colours in report.')

    args = parser.parse_args()

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(0)

    if args.sinner:
        parse_stdin()
        if weekdays[5] > MIN_SATURDAY or weekdays[6] > MIN_SUNDAY:
            sys.exit(1)

    if args.show:
        parse_stdin()
        show_report(args.colour)

    sys.exit(0)
于 2016-04-10T10:31:32.040 回答