##// END OF EJS Templates
with: use context manager for wlock in shelve cleanupcmd
Bryan O'Sullivan -
r27835:c448d7e0 default
parent child Browse files
Show More
@@ -354,16 +354,12 b' def _docreatecmd(ui, repo, pats, opts):'
354 def cleanupcmd(ui, repo):
354 def cleanupcmd(ui, repo):
355 """subcommand that deletes all shelves"""
355 """subcommand that deletes all shelves"""
356
356
357 wlock = None
357 with repo.wlock():
358 try:
359 wlock = repo.wlock()
360 for (name, _type) in repo.vfs.readdir('shelved'):
358 for (name, _type) in repo.vfs.readdir('shelved'):
361 suffix = name.rsplit('.', 1)[-1]
359 suffix = name.rsplit('.', 1)[-1]
362 if suffix in ('hg', 'patch'):
360 if suffix in ('hg', 'patch'):
363 shelvedfile(repo, name).movetobackup()
361 shelvedfile(repo, name).movetobackup()
364 cleanupoldbackups(repo)
362 cleanupoldbackups(repo)
365 finally:
366 lockmod.release(wlock)
367
363
368 def deletecmd(ui, repo, pats):
364 def deletecmd(ui, repo, pats):
369 """subcommand that deletes a specific shelve"""
365 """subcommand that deletes a specific shelve"""
General Comments 0
You need to be logged in to leave comments. Login now