Mercurial > hg-stable
changeset 46283:8db5fa212ab0
shelve: use listshelves() in cleanup function
The point of this patch is to make it so all the callers of
`shelvedfile.movetobackup()` look the same, so I can move it over to
the new `Shelf` class next.
Differential Revision: https://phab.mercurial-scm.org/D9710
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Jan 2021 22:38:19 -0800 |
parents | 0a69f9e640ec |
children | d7f763c8c58e |
files | mercurial/shelve.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/shelve.py Thu Jan 07 16:08:30 2021 -0800 +++ b/mercurial/shelve.py Thu Jan 07 22:38:19 2021 -0800 @@ -602,10 +602,11 @@ """subcommand that deletes all shelves""" with repo.wlock(): - for (name, _type) in repo.vfs.readdir(shelvedir): - suffix = name.rsplit(b'.', 1)[-1] - if suffix in shelvefileextensions: - shelvedfile(repo, name).movetobackup() + for _mtime, name in listshelves(repo): + for suffix in shelvefileextensions: + shfile = shelvedfile(repo, name, suffix) + if shfile.exists(): + shfile.movetobackup() cleanupoldbackups(repo)