Q:

How to get the age of uncommitted changes in Mercurial?

I saw a pretty neat command line prompt the other day. A guy was using ZSH and customized his prompt to display how long it had been since his last commit. I think this is pretty awesome and would like to do something similar. 
The catch is that he was using git, and I prefer Mercurial. 
Getting how long it's been since the last commit is easy enough, but misleading. If I commit changes, do something else for an hour, then come back to my codebase, it will say it's been an hour since my last commit. So I'm looking for the time it's been since the changes were started. Is this even possible through the shell or would it have to be a plugin?

A:

You could get a list of files that have uncommitted changes, and get the earliest modified date. However, if you changed a file one minute since your last commit, but then changed that same file five minutes ago, only the most recent change would count.
I have a prompt hook that shows me the number of modified files, the current revision number, branch and tag name, but it takes a noticeable amount of time to execute each time the shell prompt is shown. Can't provide any details about it right now though. 

