@ -6,6 +6,8 @@ from datetime import datetime
from urllib import urlencode
from urllib2 import HTTPError
from common import *
from time import sleep
"""
pull ( meta ) :
@ -118,10 +120,27 @@ def main (args):
f . write ( html . encode ( " utf-8 " ) )
if args . all or args . dhtml :
data [ ' startRev ' ] = " 0 "
html = getjson ( info [ ' apiurl ' ] + ' createDiffHTML? ' + urlencode ( data ) )
html = html [ ' data ' ] [ ' html ' ]
with open ( p + " .diff.html " , " w " ) as f :
f . write ( html . encode ( " utf-8 " ) )
tries = 0
skip = False
while not skip :
try :
data [ ' startRev ' ] = " 0 "
html = getjson ( info [ ' apiurl ' ] + ' createDiffHTML? ' + urlencode ( data ) )
html = html [ ' data ' ] [ ' html ' ]
with open ( p + " .diff.html " , " w " ) as f :
f . write ( html . encode ( " utf-8 " ) )
break
except HTTPError as e :
print ( " HTTPERROR {0} " . format ( e ) , file = sys . stderr )
tries + = 1
if tries > = 5 :
print ( " Too many errors, deleting .diff.html and skipping " , file = sys . stderr )
try :
os . remove ( p + " .diff.html " )
except OSError :
pass
skip = True
else :
sleep ( 0.1 )
print ( " \n {0} pad(s) changed " . format ( count ) , file = sys . stderr )