Clone the hg directory from a specific date

Is there a way to get a copy of the hg repository, as it was on a specific date?

For example, in subversion, I would use:

svn checkout -r {2012-04-04} ... 

And he will check the revision as it appeared on April 4th.

In git, its a bit more complicated, but you can do:

 git checkout `git rev-list -n 1 --before="2012-04-04" master` 

Can you do the same in hg?

+7
source share
1 answer

( EDIT: My love of revsets made me ignore the obvious answer: hg update --date 2012-04-04 should get the latest revision from this date.)

If you have already cloned the entire repository (date specifications do not work with clone ), you can do

 hg update --rev "date('< 2012-04-04')" 

If there is a possibility that there were several goals / branches in the repository at the right date, you will need to narrow it down to the desired set of changes in some additional conditions:

 hg update --rev "date('< 2012-04-04') and branch(v1.1)" 

See hg help revsets and hg help dates more details.

Later, if you want to go back to the tip, just

 hg update 
+17
source

All Articles