remotefilelog: handle missing directory

Summary:
Wez noticed that when /var/cache/hgcache/<repo>/packs/manifest was missing, `hg
repack` would fail, not repacking anything. Let's fix the offending code to
properly ignore the missing directory.

Reviewed By: quark-zju

Differential Revision: D17120206

fbshipit-source-id: 7a7aebac717e5f128565ea2f8d50ffaeda4563f9
This commit is contained in:
Xavier Deguillard 2019-08-30 11:21:30 -07:00 committed by Facebook Github Bot
parent 490a99230c
commit 689256b99d

View File

@ -704,10 +704,14 @@ def _cleanupoldpacks(ui, packpath, limit):
def _listpackfiles(path):
packs = []
for f in os.listdir(path):
_, ext = os.path.splitext(f)
if ext.endswith("pack"):
packs.append(os.path.join(packpath, f))
try:
for f in os.listdir(path):
_, ext = os.path.splitext(f)
if ext.endswith("pack"):
packs.append(os.path.join(packpath, f))
except OSError as ex:
if ex.errno != errno.ENOENT:
raise
return packs