From 689256b99df98ae658e99f04a429284b32c48d4b Mon Sep 17 00:00:00 2001 From: Xavier Deguillard Date: Fri, 30 Aug 2019 11:21:30 -0700 Subject: [PATCH] remotefilelog: handle missing directory Summary: Wez noticed that when /var/cache/hgcache//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 --- edenscm/hgext/remotefilelog/repack.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/edenscm/hgext/remotefilelog/repack.py b/edenscm/hgext/remotefilelog/repack.py index 33ead3a4aa..04e0005d2a 100644 --- a/edenscm/hgext/remotefilelog/repack.py +++ b/edenscm/hgext/remotefilelog/repack.py @@ -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