##// END OF EJS Templates
shelve: use try/except/finally
Matt Mackall -
r25080:68f456f2 default
parent child Browse files
Show More
@@ -284,17 +284,15 b' def deletecmd(ui, repo, pats):'
284 """subcommand that deletes a specific shelve"""
284 """subcommand that deletes a specific shelve"""
285 if not pats:
285 if not pats:
286 raise util.Abort(_('no shelved changes specified!'))
286 raise util.Abort(_('no shelved changes specified!'))
287 wlock = None
287 wlock = repo.wlock()
288 try:
288 try:
289 wlock = repo.wlock()
289 for name in pats:
290 try:
290 for suffix in 'hg patch'.split():
291 for name in pats:
291 shelvedfile(repo, name, suffix).unlink()
292 for suffix in 'hg patch'.split():
292 except OSError, err:
293 shelvedfile(repo, name, suffix).unlink()
293 if err.errno != errno.ENOENT:
294 except OSError, err:
294 raise
295 if err.errno != errno.ENOENT:
295 raise util.Abort(_("shelved change '%s' not found") % name)
296 raise
297 raise util.Abort(_("shelved change '%s' not found") % name)
298 finally:
296 finally:
299 lockmod.release(wlock)
297 lockmod.release(wlock)
300
298
General Comments 0
You need to be logged in to leave comments. Login now