##// END OF EJS Templates
with: use context manager for wlock in shelve deletecmd
Bryan O'Sullivan -
r27836:1c2408c2 default
parent child Browse files
Show More
@@ -365,18 +365,16 b' def deletecmd(ui, repo, pats):'
365 """subcommand that deletes a specific shelve"""
365 """subcommand that deletes a specific shelve"""
366 if not pats:
366 if not pats:
367 raise error.Abort(_('no shelved changes specified!'))
367 raise error.Abort(_('no shelved changes specified!'))
368 wlock = repo.wlock()
368 with repo.wlock():
369 try:
369 try:
370 for name in pats:
370 for name in pats:
371 for suffix in 'hg patch'.split():
371 for suffix in 'hg patch'.split():
372 shelvedfile(repo, name, suffix).movetobackup()
372 shelvedfile(repo, name, suffix).movetobackup()
373 cleanupoldbackups(repo)
373 cleanupoldbackups(repo)
374 except OSError as err:
374 except OSError as err:
375 if err.errno != errno.ENOENT:
375 if err.errno != errno.ENOENT:
376 raise
376 raise
377 raise error.Abort(_("shelved change '%s' not found") % name)
377 raise error.Abort(_("shelved change '%s' not found") % name)
378 finally:
379 lockmod.release(wlock)
380
378
381 def listshelves(repo):
379 def listshelves(repo):
382 """return all shelves in repo as list of (time, filename)"""
380 """return all shelves in repo as list of (time, filename)"""
General Comments 0
You need to be logged in to leave comments. Login now