# churn

Contents

- Commands
  - Repository maintenance

command to display statistics about repository history

# Commands

## Repository maintenance

### churn

histogram of changes to the repository:

    hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]

This command will display a histogram representing the number of changed lines or revisions, grouped according to the given template. The default template will group changes by author. The --dateformat option may be used to group the results by date instead.

Statistics are based on the number of changed lines, or alternatively the number of matching revisions if the --changesets option is specified.

Examples:

    # display count of changed lines for every committer
    hg churn -T "{author|email}"

    # display daily activity graph
    hg churn -f "%H" -s -c

    # display activity of developers by month
    hg churn -f "%Y-%m" -s -c

    # display count of lines changed in every year
    hg churn -f "%Y" -s

    # display count of lines changed in a time range
    hg churn -d "2020-04 to 2020-09"

It is possible to map alternate email addresses to a main address by providing a file using the following format:

    <alias email> = <actual email>

Such a file may be specified with the --aliases option, otherwise a .hgchurn file will be looked for in the working directory root. Aliases will be split from the rightmost "=".

Options:

`-r, --rev <REV[+]>`
| count rate for the specified revision or revset
`-d, --date <DATE>`
| count rate for revisions matching date spec
`-t, --oldtemplate <TEMPLATE>`
| template to group changesets (DEPRECATED)
`-T, --template <TEMPLATE>`
| template to group changesets (default: {author|email})
`-f, --dateformat <FORMAT>`
| strftime-compatible format for grouping by date
`-c, --changesets`
| count rate by number of changesets
`-s, --sort` | sort by key (default: sort by count)
`--diffstat` | display added/removed lines separately
`--aliases <FILE>`
| file with email aliases
`-I, --include <PATTERN[+]>`
| include names matching the given patterns
`-X, --exclude <PATTERN[+]>`
| exclude names matching the given patterns

[+] marked option can be specified multiple times