0

The hg commit command (and several others) provide the --date option to specify what date you want stored for the commit. For instance, I can do this:

hg commit --date "Oct 27 2000"

To pretend that I made the changes 13 years ago.

But I'd like to not have to specify the --date option every time I commit, and I'd like the elapsed time between commits to be correct. Is there a way I can tell mercurial something to the effect of "Consider this moment right now to be midnight on Oct 27 2000" (for instance), and have it automatically adjust all timestamps accordingly from there?

For instance, if this hypothetical command was called date, then it might look something like this:

> date
Mon Oct 28 20:00:00 EDT 2013
> hg date "Oct 27 2000 00:00:00"
>
> #edit some files
> date
Mon Oct 28 20:30:00 EDT 2013
> # 30 minutes have elapsed
>
> hg ci
> hg log
changeset:   0:2f0b7f53d6e1
tag:         tip
user:        sh1ftst0rm
date:        Sun Oct 27 00:30:00 2000 -0400
>
> #edit some more files
> date
Mon Oct 28 21:15:00 EDT 2013
> # Another 45 minutes has elapsed, 1h15m since hg date was set.
>
> hg ci
> hg log
changeset:   1:a92497e622e9
tag:         tip
user:        sh1ftst0rm
date:        Sun Oct 27 01:15:00 2000 -0400

changeset:   0:2f0b7f53d6e1
user:        sh1ftst0rm
date:        Sun Oct 27 00:30:00 2000 -0400

1 Answer 1

0

I can think of two possible solutions:

  1. Write a shell function/script hg to use instead of calling hg directly, and have it add --date to commit and other commands that require it. It will need to compute the correct date from the present date.
  2. Create a VM, and set its clock to sometime in the past, and do all hg commits from there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .