comparing dates in a mercurial hook
EHASZLA at transunion.com
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 = datetime.today() - timedelta(days=180)
if (ctx.date() < sixmonthsback):
...rest 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...
Size: 474 bytes
Desc: not available
More information about the Mercurial-devel