Updating commit timestamp on push.
Kannan Goundan
kannan at cakoose.com
Wed Dec 4 08:46:21 UTC 2013
We use Mercurial in a mostly centralized manner. We use local commits and
local branches during but eventually use some kind of history modification
to collapse things before pushing to the central repo. We do not have merge
commits in our central repo.
The problem: when I do "hg log", the commit timestamps are based on the
timestamp of the original commit. It would be more useful to us if the
timestamps represented when each commit made it to the central repo (at
least within a minute or two).
I'm trying to figure out how to achieve that. My initial attempt involves
creating an alias called "amend" that calls "hg commit --amend --date
<now>". This works, but requires that we remember to call "hg amend" right
before each push. I'm hoping for something more automatic.
For example, it would be nice if I could run a bit of code right before a
push and, for each commit that is going to be pushed:
- if it is marked immutable, fail.
- otherwise, update the timestamp to the current time.
I looked at "pre-push" hooks and also looked at the way the "mq" extension
creates a wrapper around the "push" command. Those options aren't
straightforward because it looks like I need to parse the arguments to
"push" (like "-b <branch>") to make sure I figure out the right set of
commits. I think I can copy/paste some code from the Mercurial source's
implementation of "push" to achieve my goal, but that seems brittle.
Any advice on what the right approach is?
Thanks,
- Kannan
More information about the Mercurial
mailing list