Ticket #7251 (new enhancement)
trac-post-commit-hook should use changeset time, not current time
| Reported by: | jkugler@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | low | Milestone: | 0.11-retriage |
| Component: | version control | Version: | 0.12dev |
| Severity: | normal | Keywords: | commit hook |
| Cc: |
Description
Currently, when the trac-post-commit-hook runs, it uses now() for its time. This is usually OK, but when the commit hook is run later, such as in a batch situation, or catching up after a malfunction, now() will not be accurate. The patch below fixed this. chgset.date *can* be None if the _get_prop failed to get a date, so a fallback to now() is provided.
Index: contrib/trac-post-commit-hook
===================================================================
--- contrib/trac-post-commit-hook (revision 7068)
+++ contrib/trac-post-commit-hook (working copy)
@@ -151,7 +151,10 @@
self.author = chgset.author
self.rev = rev
self.msg = "(In [%s]) %s" % (rev, chgset.message)
- self.now = datetime.now(utc)
+ if chgset.date:
+ self.now = chgset.date
+ else:
+ self.now = datetime.now(utc)
cmd_groups = command_re.findall(self.msg)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


