##// END OF EJS Templates
mq: eliminate explicit checks for file existence
Idan Kamara -
r15258:fe967744 default
parent child Browse files
Show More
@@ -287,26 +287,31 b' class queue(object):'
287
287
288 @util.propertycache
288 @util.propertycache
289 def applied(self):
289 def applied(self):
290 if os.path.exists(self.join(self.statuspath)):
290 def parselines(lines):
291 def parselines(lines):
291 for l in lines:
292 for l in lines:
292 entry = l.split(':', 1)
293 entry = l.split(':', 1)
293 if len(entry) > 1:
294 if len(entry) > 1:
294 n, name = entry
295 n, name = entry
295 yield statusentry(bin(n), name)
296 yield statusentry(bin(n), name)
296 elif l.strip():
297 elif l.strip():
297 self.ui.warn(_('malformated mq status line: %s\n') % entry)
298 msg = _('malformated mq status line: %s\n') % entry
298 # else we ignore empty lines
299 self.ui.warn(msg)
299 try:
300 # else we ignore empty lines
301 lines = self.opener.read(self.statuspath).splitlines()
300 lines = self.opener.read(self.statuspath).splitlines()
302 return list(parselines(lines))
301 return list(parselines(lines))
303 return []
302 except IOError, e:
303 if e.errno == errno.ENOENT:
304 return []
305 raise
304
306
305 @util.propertycache
307 @util.propertycache
306 def fullseries(self):
308 def fullseries(self):
307 if os.path.exists(self.join(self.seriespath)):
309 try:
308 return self.opener.read(self.seriespath).splitlines()
310 return self.opener.read(self.seriespath).splitlines()
309 return []
311 except IOError, e:
312 if e.errno == errno.ENOENT:
313 return []
314 raise
310
315
311 @util.propertycache
316 @util.propertycache
312 def series(self):
317 def series(self):
General Comments 0
You need to be logged in to leave comments. Login now