remotefilelog: use util.unlink instead of os.unlink

Summary:
The former will always succeed on Windows, while the later raise an Exception
when the file is opened elsewhere.

Reviewed By: quark-zju

Differential Revision: D15571023

fbshipit-source-id: b7ee739dce49f9a9ba5087ec785a6dc332eb88c8
This commit is contained in:
Xavier Deguillard 2019-05-30 18:41:35 -07:00 committed by Facebook Github Bot
parent a805a7acac
commit 34344946cd

View File

@ -726,15 +726,15 @@ def _cleanupoldpacks(ui, packpath, limit):
root, ext = os.path.splitext(f)
try:
if ext == datapack.PACKSUFFIX:
os.unlink(root + datapack.INDEXSUFFIX)
util.unlink(root + datapack.INDEXSUFFIX)
else:
os.unlink(root + historypack.INDEXSUFFIX)
util.unlink(root + historypack.INDEXSUFFIX)
except OSError as ex:
if ex.errno != errno.ENOENT:
raise
try:
os.unlink(f)
util.unlink(f)
except OSError as ex:
if ex.errno != errno.ENOENT:
raise