<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository trac.macports.org.
</pre>
<p><a href="https://github.com/macports/trac.macports.org/commit/26b29228d1171ac015b0973b5451b5da06f20f8d">https://github.com/macports/trac.macports.org/commit/26b29228d1171ac015b0973b5451b5da06f20f8d</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new 26b2922 trac-github-update: fix run error on tag deletions
</span>26b2922 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 26b29228d1171ac015b0973b5451b5da06f20f8d
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Tue Nov 29 01:46:00 2016 +0100
<span style='display:block; white-space:pre;color:#404040;'> trac-github-update: fix run error on tag deletions
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> GitHub will indicate a tag deletion with the special value of
</span><span style='display:block; white-space:pre;color:#404040;'> "0000000000000000000000000000000000000000" as new revision. Whenever the
</span><span style='display:block; white-space:pre;color:#404040;'> change does not reference a valid new SHA1 hash, use the current
</span><span style='display:block; white-space:pre;color:#404040;'> timestamp as fallback.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/52941
</span>---
plugins/hooks/trac-github-update.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/plugins/hooks/trac-github-update.py b/plugins/hooks/trac-github-update.py
</span><span style='display:block; white-space:pre;color:#808080;'>index 6d618f5..ad41188 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/plugins/hooks/trac-github-update.py
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/plugins/hooks/trac-github-update.py
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -270,9 +270,13 @@ def run_as_github_webhook(environment, mailer):
</span>
change = ReferenceChange.create(environment, oldrev, newrev, refname)
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # get committer time of the newest revision that was pushed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- timestamp = read_git_output(['log', '--no-walk', '--format=%ct', change.new.sha1])
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # monkey patch it into git_multimail
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if change.new.sha1:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # get committer time of the newest revision that was pushed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ timestamp = read_git_output(['log', '--no-walk', '--format=%ct', change.new.sha1])
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # use current time for tag or branch deletions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ timestamp = time.time()
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # monkey patch new time base into git_multimail
</span> IncrementalDateTimeWithStartTime.start_time = float(timestamp)
git_multimail.IncrementalDateTime = IncrementalDateTimeWithStartTime
</pre><pre style='margin:0'>
</pre>