D9737: shelve: use listdir() instead of readdir() when we don't need stat information

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Jan 12 22:49:23 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9737

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -617,14 +617,14 @@
 def listshelves(repo):
     """return all shelves in repo as list of (time, name)"""
     try:
-        names = repo.vfs.readdir(shelvedir)
+        names = repo.vfs.listdir(shelvedir)
     except OSError as err:
         if err.errno != errno.ENOENT:
             raise
         return []
     info = []
     seen = set()
-    for (filename, _type) in names:
+    for filename in names:
         name = filename.rsplit(b'.', 1)[0]
         if name in seen:
             continue



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list