diff mercurial/debugcommands.py @ 44318:20e125cdd719

nodemap: add basic checking of the on disk nodemap content The simplest check it so verify we have all the revision we needs, and nothing more. Differential Revision: https://phab.mercurial-scm.org/D7845
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Jan 2020 15:48:57 +0100
parents 6c07480d6659
children 76a96e3a2bbb
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Jan 15 15:48:47 2020 +0100
+++ b/mercurial/debugcommands.py	Wed Jan 15 15:48:57 2020 +0100
@@ -2094,6 +2094,12 @@
             _(b'write a (new) persistent binary nodemap on stdin'),
         ),
         (b'', b'dump-disk', False, _(b'dump on-disk data on stdin')),
+        (
+            b'',
+            b'check',
+            False,
+            _(b'check that the data on disk data are correct.'),
+        ),
     ],
 )
 def debugnodemap(ui, repo, **opts):
@@ -2109,6 +2115,11 @@
         cl = unfi.changelog
         data = nodemap.persisted_data(cl)
         ui.write(data)
+    elif opts['check']:
+        unfi = repo.unfiltered()
+        cl = unfi.changelog
+        data = nodemap.persisted_data(cl)
+        return nodemap.check_data(ui, cl.index, data)
 
 
 @command(