mercurial/debugcommands.py
changeset 40365 4f37af86d5d5
parent 40174 64360202d5b2
child 40456 24cb8a6d4c20
--- a/mercurial/debugcommands.py	Thu Oct 18 11:24:20 2018 -0400
+++ b/mercurial/debugcommands.py	Thu Oct 18 10:11:08 2018 -0700
@@ -1168,7 +1168,10 @@
 def debugindexstats(ui, repo):
     """show stats related to the changelog index"""
     repo.changelog.shortest(nullid, 1)
-    for k, v in sorted(repo.changelog.index.stats().items()):
+    index = repo.changelog.index
+    if not util.safehasattr(index, 'stats'):
+        raise error.Abort(_('debugindexstats only works with native code'))
+    for k, v in sorted(index.stats().items()):
         ui.write('%s: %s\n' % (k, v))
 
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)