smartlog: be graceful when ancestorcache db is corrupted

Summary:
We have seem some errors when closing the database during `db.close()`. This
diff nukes the database if that happens.

Test Plan: arc unit

Reviewers: #mercurial, mjpieters

Reviewed By: mjpieters

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5305123

Signature: t1:5305123:1498166056:8355e861c18c670e6342e541f2bc55d65bc7b1c8
This commit is contained in:
Jun Wu 2017-06-22 14:15:56 -07:00
parent 9384ed14b8
commit c35c433212

View File

@ -86,7 +86,11 @@ def ancestorcache(path):
yield
finally:
extensions.unwrapfunction(revlog.revlog, 'ancestor', revlogancestor)
db.close()
try:
db.close()
except Exception:
# database corruption, we just nuke the database
util.tryunlink(path)
def _drawendinglines(orig, lines, extra, edgemap, seen):
# if we are going to have only one single column, draw the missing '|'s