Search code examples
bashmercurialrevisionhg-log

hg log - how to display a date range of revisions in reverse order?


In bash, I am using a date range to restrict the number of revisions showed as follows:

hg log -d "yyyy-mm-dd to yyyy-mm-dd"

I would like to output to display the most recent revision at the bottom. Currently, it starts with the most recent at the top & works it's way down.

Thanks in advance!


I am trying to implement the hg log -r "(date("$startdate to $enddate"))" solution into a bash script as per below:

read -p "Specify start of date range(yyyy-mm-dd): " startdate
read -p "Specify end of date range(yyyy-mm-dd): " enddate
hg log -r '(date("$startdate to $enddate"))'

However, the variables are no longer recognised. I have tried using double quotes & also quoting the variables themselves but no avail. Any help is appreciated!


Solution

  • You could use revsets instead:

    hg log -r 'reverse(date("yyyy-mm-dd to yyyy-mm-dd"))'