##// END OF EJS Templates
commands: use a context manager for file I/O in debugdiscovery
Bryan O'Sullivan -
r27771:338c9d22 default
parent child Browse files
Show More
@@ -2311,8 +2311,7 def debugdiscovery(ui, repo, remoteurl="
2311 serverlogs = opts.get('serverlog')
2311 serverlogs = opts.get('serverlog')
2312 if serverlogs:
2312 if serverlogs:
2313 for filename in serverlogs:
2313 for filename in serverlogs:
2314 logfile = open(filename, 'r')
2314 with open(filename, 'r') as logfile:
2315 try:
2316 line = logfile.readline()
2315 line = logfile.readline()
2317 while line:
2316 while line:
2318 parts = line.strip().split(';')
2317 parts = line.strip().split(';')
@@ -2324,9 +2323,6 def debugdiscovery(ui, repo, remoteurl="
2324 elif op == 'unb':
2323 elif op == 'unb':
2325 doit(parts[3].split(' '), parts[2].split(' '))
2324 doit(parts[3].split(' '), parts[2].split(' '))
2326 line = logfile.readline()
2325 line = logfile.readline()
2327 finally:
2328 logfile.close()
2329
2330 else:
2326 else:
2331 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
2327 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
2332 opts.get('remote_head'))
2328 opts.get('remote_head'))
General Comments 0
You need to be logged in to leave comments. Login now