title: How to resolve "integrity errors" revealed by "hg verify"
body: <p>I have a shared repository for which <code>hg verify</code> reveals seven problems attributable to a very old changeset (@2445).</p>
  
  <p>Having failed to repair the repository as described
  in detail below, I would greatly appreciate
  any advice about repairing it.  </p>
  
  <p>Please note that I have successfully used "hg convert" to create a new repository which passes the <code>hg verify</code> test, but of course the revision
  hashes are all different, so this is not really a solution for the
  "corrupt" repository that is on bitbucket and that others have cloned.</p>
  
  <h3>Problem Description</h3>
  
  <p>The repository on bitbucket has been cloned to two machines, one
  running hg 4.7.2, and the other running hg 5.0.1.</p>
  
  <p>The clone on the hg 4.7.2 machine never exhibited any overt problems,
  but the upgrade to hg 5.0.1 on the other led me to run "hg verify",
  which reveals the same 7 errors on both machines.</p>
  
  <p>(On the hg 5.0.1 machine, additional issues involving "fncache" are identified but they go beyond the scope of this question.)</p>
  
  <p>The 7 errors are identified in the section of the "hg verify"
  output beginning:</p>
  
  <pre><code>crosschecking files in changesets and manifests
  checking files
  </code></pre>
  
  <p>The first error message is:</p>
  
  <pre><code>MI/MI_s15/all/done@2445: dbb0190415fa not in manifests
  </code></pre>
  
  <p>and all the others refer to the same local rev "@2445".</p>
  
  <p>The final line of the output of "hg verify" is:</p>
  
  <pre><code>(first damaged changeset appears to be 2445)
  </code></pre>
  
  <h3>Attempted Repairs</h3>
  
  <p>The following attempts all failed to fix these problems:</p>
  
  <p>a) hg debugrebuildstate -r tip</p>
  
  <p>b) hg debugrebuildfncache # failed with the explanation: "(not rebuilding fncache because repository does not support fncache)"</p>
  
  <p>c) In a new directory on the hg 5.0.1 machine, cloning the repository from its home on bitbucket did not help.</p>
  
  <p>d) In the newly cloned repo created in (c) above:</p>
  
  <pre><code>hg strip --rev 2444
  hg pull -u
  # `hg verify` shows the same 7 errors
  hg debugrebuildfncache # now succeeds
  # `hg verify` shows the same 7 errors
  </code></pre>
  
  <p>Similar attempts likewise failed.</p>
  
  <h2>debugindex</h2>
  
  <p>In case it helps:</p>
  
  <pre><code>   $ hg debugindex MI/MI_s15/all/done
     rev linkrev nodeid       p1           p2
       0    1337 b5d33daadd43 000000000000 000000000000
       1    2445 dbb0190415fa 000000000000 000000000000
  </code></pre>