Order of commits from hg log?

Peter Hull peterhull90 at gmail.com
Mon Jun 23 15:04:55 UTC 2014


I noticed something odd when trying to get a change log for a subset
of my repository (which contains merge commits)
I was typing
hg log -M -r x:y --style changelog
and I noticed that -r x:y and -r y:x both gave the same order of
commits (tip last) whereas without the -r flag it was tip first (as
expected)
The --style is irrelevant but if -M is not specified it again behaves
as expected. I made a script to test this (see below) and it doesn't
matter if the repository actually has merge commits or not.

I am using Mercurial Distributed SCM (version 3.0.1) on Cygwin

Can anyone clarify this - this may be the designed behavour or I might
have got it all mixed up?

Thanks,
Peter

Script:
#!/bin/bash

rm -rf h
hg init h
cd h
echo 1 > dummy_file
hg add dummy_file
hg commit -m"first"
echo 2 > dummy_file
hg commit -m"second"

T="{rev} {tags} {node}\n"

echo  ___ Normal
hg log --template "$T"
echo  ___ Reversed
hg log -r : --template "$T"

echo  ___ Explicit Normal
hg log -r tip:0 --template "$T"
echo  ___ Explicit Reversed
hg log -r 0:tip --template "$T"

echo  ___ Normal no merge
hg log -M --template "$T"
echo  ___ Reversed no merge
hg log -r : -M --template "$T"

echo  ___ Explicit Normal no merge
hg log -r tip:0 -M --template "$T"
echo  ___ Explicit Reversed no merge
hg log -r 0:tip -M --template "$T"

Output:
___ Normal
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
___ Reversed
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
___ Explicit Normal
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
___ Explicit Reversed
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
___ Normal no merge
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
___ Reversed no merge
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
___ Explicit Normal no merge
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991
___ Explicit Reversed no merge
0  a4b92974f8925e315ce250c36c91ff4a860c29a2
1 tip 9903debc3da50938a62d16cc8ccd3c43eb50e991

Expected output:
'Explicit Normal no merge' to be the same as 'Normal'



More information about the Mercurial mailing list