pushlog: use modern mechanism for disabling demand importing; r=glandium
authorGregory Szorc <gps@mozilla.com>
Thu, 14 Jul 2016 09:57:13 -0700
changeset 8958 3b2b801c7e7674f09d3853e99d95cbcc4eecd174
parent 8957 7a874e1c98d71fa18d1a589ab65b566169e4e547
child 8959 62aae13f736e626fa28c3f825f795570fbf3a8fc
push id1034
push userbmo:gps@mozilla.com
push dateTue, 19 Jul 2016 18:10:24 +0000
reviewersglandium
pushlog: use modern mechanism for disabling demand importing; r=glandium This is safer than the alternative, which may enable if we were disabled going in. The new API was added in Mercurial 3.5. MozReview-Commit-ID: CmL3jO8gy2m
hgext/pushlog-legacy/pushlog-feed.py
--- a/hgext/pushlog-legacy/pushlog-feed.py
+++ b/hgext/pushlog-legacy/pushlog-feed.py
@@ -12,21 +12,20 @@ from mercurial import demandimport
 
 import sys, os.path, re
 from datetime import datetime
 import time
 from math import ceil
 
 sys.path.append(os.path.dirname(__file__))
 
-demandimport.disable()
-from parsedatetime import parsedatetime as pdt
+with demandimport.deactivated():
+    from parsedatetime import parsedatetime as pdt
 
 import sqlite3
-demandimport.enable()
 
 testedwith = '3.6 3.7'
 
 cal = pdt.Calendar()
 PUSHES_PER_PAGE = 10
 
 def addcommand(f, name):
     setattr(hgwebprotocol, name, f)