Merlijn van Deen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/105498


Change subject: Only post 'moved' messages on recent bugs
......................................................................

Only post 'moved' messages on recent bugs

Change-Id: Ic74d84e875c725ea512072fb8f605a386f69ebd9
---
M jira.py
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/sf-export 
refs/changes/98/105498/1

diff --git a/jira.py b/jira.py
index ab78020..cb3ba9e 100644
--- a/jira.py
+++ b/jira.py
@@ -344,6 +344,9 @@
     print " -- %i comments, %i attachments" % (ncs, natt)
     sys.stdout.flush()
 
+    print "Age: %i days" % (abs(fields['updated'] - datetime.now()).days)
+    recentBug = abs(fields['updated'] - datetime.now()).days < 90
+
     if saveMigration:
         comment = "This bug has been migrated to Bugzilla: 
https://bugzilla.wikimedia.org/%i"; % bug.bug_id
         response = requests.post(issue['self'] + "/transitions",
@@ -362,10 +365,11 @@
 
         if response.status_code != 204: #ok
             print "WARNING: Cannot transition bug %s: %s" % (issue['key'], 
response.text)
-            requests.post(issue['self'] + "/comment",
-                headers={"content-type": "application/json"},
-                data=json.dumps({'body': comment}),
-                auth=('bugzilla-exporter', password)
-            )
+            if recentBug:
+                requests.post(issue['self'] + "/comment",
+                    headers={"content-type": "application/json"},
+                    data=json.dumps({'body': comment}),
+                    auth=('bugzilla-exporter', password)
+                )
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/105498
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic74d84e875c725ea512072fb8f605a386f69ebd9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/sf-export
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhall...@arctus.nl>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to