363 |
363 |
364 def deletecmd(ui, repo, pats): |
364 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)""" |
383 try: |
381 try: |
384 names = repo.vfs.readdir('shelved') |
382 names = repo.vfs.readdir('shelved') |