# git vs hg commit counts?

6 messages from 2009-10-27 to 2009-10-27. Participants: Joe Perches, Junio C Hamano, Jakub Narebski, Marti Raudsepp.
Thread: https://gitlist.dev/t/21367

## Joe Perches, 2009-10-27 00:08

Subject: git vs hg commit counts?
Message-ID: <1256602127.29938.8.camel@Joe-Laptop.home>
URL: https://gitlist.dev/e/1256602127.29938.8.camel%40Joe-Laptop.home

```
I'm comparing linux-kernel git vs hg repositories.

While testing some changes to scripts/get_maintainer.pl,
I noticed that git and hg have different commit counts
for the same files.

For instance:

$ git log --since=1-year-ago -- MAINTAINERS | \
	grep -P "^commit [0-9a-f]{40,40}$"  | wc -l
514

$ hg log --template="commit {node}\n" --date -365 -- MAINTAINERS  | \
	grep -P "^commit [0-9a-f]{40,40}$" | wc -l
601

Anyone have any understanding why?

```

## Junio C Hamano, 2009-10-27 00:18

Subject: Re: git vs hg commit counts?
Message-ID: <7v8wexd6zq.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v8wexd6zq.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1256602127.29938.8.camel@Joe-Laptop.home>

```
Joe Perches <joe@perches.com> writes:

> I'm comparing linux-kernel git vs hg repositories.
>
> While testing some changes to scripts/get_maintainer.pl,
> I noticed that git and hg have different commit counts
> for the same files.
>
> For instance:
>
> $ git log --since=1-year-ago -- MAINTAINERS | \
> 	grep -P "^commit [0-9a-f]{40,40}$"  | wc -l
> 514
>
> $ hg log --template="commit {node}\n" --date -365 -- MAINTAINERS  | \
> 	grep -P "^commit [0-9a-f]{40,40}$" | wc -l
> 601
>
> Anyone have any understanding why?

We simplify a merge history by discarding one branch when the merge result
matches one of the parents.  Does "hg" know how to do that as well?

```

## Joe Perches, 2009-10-27 00:23

Subject: Re: git vs hg commit counts?
Message-ID: <1256602985.29938.18.camel@Joe-Laptop.home>
URL: https://gitlist.dev/e/1256602985.29938.18.camel%40Joe-Laptop.home
In-Reply-To: <7v8wexd6zq.fsf@alter.siamese.dyndns.org>

```
On Mon, 2009-10-26 at 17:18 -0700, Junio C Hamano wrote:
> > $ git log --since=1-year-ago -- MAINTAINERS | \
> > 	grep -P "^commit [0-9a-f]{40,40}$"  | wc -l
> > 514
> > $ hg log --template="commit {node}\n" --date -365 -- MAINTAINERS  | \
> > 	grep -P "^commit [0-9a-f]{40,40}$" | wc -l
> > 601
> > Anyone have any understanding why?
> We simplify a merge history by discarding one branch when the merge result
> matches one of the parents.

Thanks Junio.

> Does "hg" know how to do that as well?

I don't know.

I was hoping to get equivalent results though.

Anyone know how?

```

## Jakub Narebski, 2009-10-27 01:14

Subject: Re: git vs hg commit counts?
Message-ID: <m3zl7dd4g6.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3zl7dd4g6.fsf%40localhost.localdomain
In-Reply-To: <1256602127.29938.8.camel@Joe-Laptop.home>

```
Joe Perches <joe@perches.com> writes:

> I'm comparing linux-kernel git vs hg repositories.
> 
> While testing some changes to scripts/get_maintainer.pl,
> I noticed that git and hg have different commit counts
> for the same files.
> 
> For instance:
> 
> $ git log --since=1-year-ago -- MAINTAINERS | \
> 	grep -P "^commit [0-9a-f]{40,40}$"  | wc -l
> 514
> 
> $ hg log --template="commit {node}\n" --date -365 -- MAINTAINERS  | \
> 	grep -P "^commit [0-9a-f]{40,40}$" | wc -l
> 601
> 
> Anyone have any understanding why?

It *might* be caused by the fact that in Mercurial commit can have
only up to two parents.  This means that octopus merges (merge commits
with more than two parents: there are a few of them in linux-kernel
history) have to be represented as a set of two-parent merges.

-- 
Jakub Narebski

http://stackoverflow.com/questions/1598759/git-and-mercurial-compare-and-contrast/1599930#1599930

```

## Marti Raudsepp, 2009-10-27 01:16

Subject: Re: git vs hg commit counts?
Message-ID: <54b33ccd0910261816x3c49d4ccr60a80a88dd4cfac9@mail.gmail.com>
URL: https://gitlist.dev/e/54b33ccd0910261816x3c49d4ccr60a80a88dd4cfac9%40mail.gmail.com
In-Reply-To: <7v8wexd6zq.fsf@alter.siamese.dyndns.org>

```
On Tue, Oct 27, 2009 at 2:18 AM, Junio C Hamano <gitster@pobox.com> wrote:
> We simplify a merge history by discarding one branch when the merge result
> matches one of the parents.  Does "hg" know how to do that as well?

57 of the differing changesets are normal merges (probably what Junio explained)
3 are duplicate changesets in hg, probably also related to that
27 changesets are octopus merge fixups

wrt octopus merges: in git, one merge commit can have an arbitrary
number of parents, but in hg a merge changeset always has 2 parents --
so a octopus merge is represented as multiple distinct changesets.

Marti

```

## Joe Perches, 2009-10-27 04:14

Subject: Re: git vs hg commit counts?
Message-ID: <1256616869.29938.30.camel@Joe-Laptop.home>
URL: https://gitlist.dev/e/1256616869.29938.30.camel%40Joe-Laptop.home
In-Reply-To: <54b33ccd0910261816x3c49d4ccr60a80a88dd4cfac9@mail.gmail.com>

```
On Tue, 2009-10-27 at 03:16 +0200, Marti Raudsepp wrote:
> On Tue, Oct 27, 2009 at 2:18 AM, Junio C Hamano <gitster@pobox.com> wrote:
> > We simplify a merge history by discarding one branch when the merge result
> > matches one of the parents.  Does "hg" know how to do that as well?
> 
> 57 of the differing changesets are normal merges (probably what Junio explained)
> 3 are duplicate changesets in hg, probably also related to that
> 27 changesets are octopus merge fixups
> 
> wrt octopus merges: in git, one merge commit can have an arbitrary
> number of parents, but in hg a merge changeset always has 2 parents --
> so a octopus merge is represented as multiple distinct changesets.

Thanks.

For hg support in get_maintainers, it's probably
simplest to ignore the delta in number of commits
as "close enough".

```
