# HG changeset patch # User Pierre-Yves David # Date 1592042278 -7200 # Node ID affe0fb42250c9ee77386a048c5b55a12b325461 # Parent 6c8384afbf770be2167478fff3cb9b92e1182a06 nodemap: fix validity checking when revlog is too short We cannot check the nodeid of a revision that is not even there. We add a simple fix and simple test. diff -r 6c8384afbf77 -r affe0fb42250 mercurial/revlog.py --- a/mercurial/revlog.py Tue Jun 09 05:24:45 2020 +0200 +++ b/mercurial/revlog.py Sat Jun 13 11:57:58 2020 +0200 @@ -651,7 +651,10 @@ nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: docket = nodemap_data[0] - if d[0][docket.tip_rev][7] == docket.tip_node: + if ( + len(d[0]) > docket.tip_rev + and d[0][docket.tip_rev][7] == docket.tip_node + ): # no changelog tampering self._nodemap_docket = docket index.update_nodemap_data(*nodemap_data) diff -r 6c8384afbf77 -r affe0fb42250 tests/test-persistent-nodemap.t --- a/tests/test-persistent-nodemap.t Tue Jun 09 05:24:45 2020 +0200 +++ b/tests/test-persistent-nodemap.t Sat Jun 13 11:57:58 2020 +0200 @@ -411,3 +411,25 @@ .hg/store/00changelog-????????????????.nd: size=123584, sha256=8c6cef6fd3d3fac291968793ee19a4be6d0b8375e9508bd5c7d4a8879e8df180 (glob) (pure !) .hg/store/00changelog-????????????????.nd: size=123584, sha256=eb9e9a4bcafdb5e1344bc8a0cbb3288b2106413b8efae6265fb8a7973d7e97f9 (glob) (rust !) .hg/store/00changelog-????????????????.nd: size=123136, sha256=4f504f5a834db3811ced50ab3e9e80bcae3581bb0f9b13a7a9f94b7fc34bcebe (glob) (no-pure no-rust !) + +Check that removing content does not confuse the nodemap +-------------------------------------------------------- + +removing data with rollback + + $ echo aso > a + $ hg ci -m a4 + $ hg rollback + repository tip rolled back to revision 5005 (undo commit) + working directory now based on revision 5005 + $ hg id -r . + bae4d45c759e tip + +roming data with strip + + $ echo aso > a + $ hg ci -m a4 + $ hg --config extensions.strip= strip -r . --no-backup + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg id -r . --traceback + bae4d45c759e tip