项目作者: yoshinorin

项目描述 :
Get commit log statistics of git repository
高级语言: JavaScript
项目地址: git://github.com/yoshinorin/git-commit-statistics.git
创建时间: 2018-06-22T07:37:30Z
项目社区:https://github.com/yoshinorin/git-commit-statistics

开源协议:MIT License

下载


git-commit-statistics

Codacy Badge
NPM version
Build Status Coverage Status

Get commit log statistics of git repository.

Features

Can get belows statistics. Examples of result are here.

  • byPerDayOfMonth
  • byPerMonth
  • byPerWeekDays
  • byPerYear
  • byPerDayHour
  • byDayHourOfWeekDay

Installation

  1. $ npm install git-commit-statistics

Usaga

  1. const CommitStatistics = require('git-commit-statistics');
  2. const cs = new CommitStatistics('<yourRepositoryPath>/.git');
  3. //No options
  4. let result = cs.getByPerDayOfMonth();
  5. //With options
  6. const options = {
  7. author: 'YoshinoriN',
  8. since: '2017-01-01',
  9. after: '2018-01-01',
  10. maxCount: 100,
  11. noMerges: true
  12. };
  13. let result = cs.getByPerDayOfMonth(options);

All available methods are belows.

name options result
getByPerDayOfMonth() Options example
getByPerMonth() Options example
getByPerWeekDay() Options example
getByPerYear() Options example
getByDayHour() Options example
getByDayHourOfWeekDay() Options example

Options

Input argument to each method. Example is below.

  1. const options = {
  2. author: 'YoshinoriN',
  3. maxCount: 100
  4. };
  5. let result = cs.getByPerDayOfMonth(options);

Allowable options for each methods argument.

name type example
author string ‘YoshinoriN’
since string ‘2017-01-01’
after string ‘2018-01-01’
until string ‘2018-01-01’
before string ‘2018-01-01’
maxCount number 100
noMerges boolean true

Please see official git document what is mean.

Examples of Result

Example result of each methods.

getByPerDayOfMonth

  1. [ { day: 1, count: 809 },
  2. { day: 2, count: 733 },
  3. ...
  4. { day: 30, count: 642 },
  5. { day: 31, count: 340 } ]

getByPerMonth

  1. [ { id: 1, month: 'Jan', count: 2124 },
  2. { id: 2, month: 'Feb', count: 2147 },
  3. ...
  4. { id: 11, month: 'Nov', count: 1631 },
  5. { id: 12, month: 'Dec', count: 2110 } ]

getByPerWeekDay

  1. [ { id: 0, dayOfWeek: 'Sun', count: 1891 },
  2. { id: 1, dayOfWeek: 'Mon', count: 3899 },
  3. ...
  4. { id: 5, dayOfWeek: 'Fri', count: 3765 },
  5. { id: 6, dayOfWeek: 'Sat', count: 1950 } ]

getByPerYear

  1. [ { year: 2009, count: 915 },
  2. { year: 2010, count: 1945 },
  3. ...
  4. { year: 2017, count: 4610 },
  5. { year: 2018, count: 3429 } ]

getByDayHour

  1. [ { hour: 0, count: 744 },
  2. { hour: 1, count: 671 },
  3. ...
  4. { hour: 22, count: 987 },
  5. { hour: 23, count: 938 } ]

getByDayHourOfWeekDay

  1. { id: 0,
  2. Sun:
  3. [ { hour: 11, count: 1 },
  4. { hour: 12, count: 1 },
  5. { hour: 23, count: 1 } ] }
  6. { id: 1,
  7. Mon:
  8. [ { hour: 8, count: 1 },
  9. { hour: 9, count: 3 },
  10. ...
  11. { hour: 20, count: 2 },
  12. { hour: 21, count: 1 } ] }
  13. ...
  14. { id: 5,
  15. Fri:
  16. [ { hour: 5, count: 4 },
  17. { hour: 7, count: 2 },
  18. ...
  19. { hour: 21, count: 1 } ] }
  20. { id: 6,
  21. Sat:
  22. [ { hour: 1, count: 2 },
  23. { hour: 4, count: 1 },
  24. ...
  25. { hour: 20, count: 1 },
  26. { hour: 21, count: 2 } ] }

License

MIT