How to get commits summary in Mercurial

I would like to get a summary of commits with the following information

  • The number of days of work, the beginning of the day and the end of the day.
  • Activity summary by day - the number of commits and the number of lines has changed.

Is there an extension that does this?

+4
source share
2 answers

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

  • Date of first commit of last commit

The initial commit always has a turn of 0, the last is always a hint

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

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

  • Number of days worked: the number of days with a non-zero number of commits

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

  • Daily activity summary - just the number of commits

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

number of rows changed (first ugly iteration of the project: "feci quod potui, faciant meliora potentes")

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

An example of the output of such a 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 a placeholder, you need to write the current date in this format to the command

Note 2: Less than an hour to prepare and test the results.

+9
source

LazyBadger's answer gives you a way to find out the dates of the first and last commit. To break down the number of committed daily change sets and lines of code, enable the debug extension that comes with Mercurial. In any global or repository configuration:

 [extensions] churn= 

Then, to break down the number of changes per day in chronological order:

 $ hg churn --template "{date|shortdate}" --sort --changesets 

or for lines of code:

 $ hg churn --template "{date|shortdate}" --sort 

with diffstat option to display added / deleted rows separately:

 $ hg churn --template "{date|shortdate}" --sort --diffstat 

Check hg help churn for additional options, such as limiting the date range or changes.

+6
source

All Articles