[Updated] D10458: nodemap: deal with data mmap error
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Sat Apr 17 22:13:44 UTC 2021
Closed by commit rHGa3720569a43f: nodemap: deal with data mmap error (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
CHANGED PRIOR TO COMMIT
https://phab.mercurial-scm.org/D10458?vs=26970&id=27003#toc
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10458?vs=26970&id=27003
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10458/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10458
AFFECTED FILES
mercurial/revlogutils/nodemap.py
tests/test-persistent-nodemap.t
CHANGE DETAILS
diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t
--- a/tests/test-persistent-nodemap.t
+++ b/tests/test-persistent-nodemap.t
@@ -799,9 +799,13 @@
Check that Mercurial reaction to this event
- $ hg -R corruption-test-repo log -r .
- abort: index 00changelog.i is corrupted
- [50]
+ $ hg -R corruption-test-repo log -r . --traceback
+ changeset: 5005:90d5d3ba2fc4
+ tag: tip
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: a2
+
stream clone
diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py
--- a/mercurial/revlogutils/nodemap.py
+++ b/mercurial/revlogutils/nodemap.py
@@ -53,7 +53,11 @@
try:
with revlog.opener(filename) as fd:
if use_mmap:
- data = util.buffer(util.mmapread(fd, data_length))
+ try:
+ data = util.buffer(util.mmapread(fd, data_length))
+ except ValueError:
+ # raised when the read file is too small
+ data = b''
else:
data = fd.read(data_length)
except (IOError, OSError) as e:
To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210417/19019bc5/attachment-0002.html>
More information about the Mercurial-patches
mailing list