How to get a summary of commits in Mercurial

mercurial

Solution

`hg help log` + `hg help diff` + `hg help revsets` + `hg help templating` `hg help dates` + bash

- Date of first commit|last commit

Initial commit always has rev 0, latest is always tip

`hg log -r 0 --template "{date|date}\n"`

`hg log -r tip --template "{date|date}\n"`

- Number of days worked: number of days with non-zero number of commits

`hg log --template "{date(date,'%d%m%y')}\n" | sort -u | wc -l`

- Activity summary by day - just number of commits

`hg log -r "date('YYYY-MM-DD')" --template "{.}\n" | wc -l`

number of lines changed (first ugly draft iteration: "feci quod potui, faciant meliora potentes")

`hg diff --stat -r "first(date('YYYY-MM-DD'))" -r "last(date('YYYY-MM-DD'))"`

Sample output of such diff

 404.php        |    4 +-
 comments.php   |   14 +-----
 footer.php     |    2 +-
 functions.php  |   24 +++++++++-
 header.php     |    2 +-
 readme.txt     |   38 +++++++++++++++++
 screenshot.png |  Bin
 search.php     |   12 +++-
 sidebar.php    |   45 ++------------------
 style.css      |  121 +++++++++++++++++++++++++++----------------------------
 10 files changed, 139 insertions(+), 123 deletions(-)

Note: YYYY-MM-DD is placeholder, you have to write real datein this format into command

Note 2: Less than hour for preparing and testing results!!!

Problem

I would like to get a summary of commits with the following information - Number of days worked, start day & end day. - Activity summary by day - just number of commits & number of lines changed. Is there an extension which does this ?

Original source