comparing dates in a mercurial hook

Haszlakiewicz, Eric EHASZLA at
Fri Oct 14 13:05:18 CDT 2011

I'm trying to write a hook that doesn't apply to changesets older than 6 months, but I'm having trouble actually performing the date comparison.  I can't figure out what the date() function is returning, or how to work with it.  Can someone point me at an example that does stuff with the dates?

Here's a snippet of the code I have:

def myhook(ui, repo, rev):
    ctx = repo[rev]
    """ don't validate really old changesets """
    sixmonthsback = - timedelta(days=180)
    if ( < sixmonthsback):
        return 0 of hook...

In a more general sense, is there a good way to tell what any particular method returns?  I find that I spend tons of time reading through code just to figure out what kind of object I'm working with.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 474 bytes
Desc: not available
URL: <>

More information about the Mercurial-devel mailing list