Edgewall Software

Ticket #7251 (new enhancement)

Opened 7 months ago

Last modified 7 months ago

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

post-commit-changeset-date.patch (0.5 KB) - added by daniel.stockman@… 4 months ago.
patch updated to latest version, trailing newline added to patch to avoid error

Change History

Changed 7 months ago by jkugler@…

  • summary changed from trac-post-commit-hook should use time changeset, not current time to trac-post-commit-hook should use changeset time, not current time

Changed 7 months ago by nkantrowitz

  • keywords chgset date removed
  • priority changed from normal to low
  • version set to 0.12dev
  • component changed from timeline to version control
  • milestone set to 0.11.1

Changed 4 months ago by daniel.stockman@…

patch updated to latest version, trailing newline added to patch to avoid error

Add/Change #7251 (trac-post-commit-hook should use changeset time, not current time)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.