2

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!

user3792362
  • 45
  • 2
  • 9

1 Answers1

8

You could use revsets instead:

hg log -r 'reverse(date("yyyy-mm-dd to yyyy-mm-dd"))'
zerkms
  • 249,484
  • 69
  • 436
  • 539
  • Just a follow on question. I am trying to implement the above into a bash script as per the 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 accepted in this format. I have tried with double quotes and quoting the variables to no avail. Any ideas? Thanks! – user3792362 Jul 02 '14 at 03:02
  • 1
    Replace outer single quotes with double and escape the inner quotes with a backslash – zerkms Jul 02 '14 at 03:05
  • Works for me. Example: hg log -r "reverse(date(\"2020-12-31 to 2021-01-01\"))" – Naveen Kumar V May 12 '21 at 14:52