verify: small refactoring and documentation in `_verifymanifest`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 06 Mar 2019 14:43:02 +0100
changeset 41877 9c5a6af74afa
parent 41876 5ad5a70df2f7
child 41878 82884bbf8d2b
verify: small refactoring and documentation in `_verifymanifest` Small changes to make this area of code clearer.
mercurial/verify.py
--- a/mercurial/verify.py	Wed Mar 06 12:39:44 2019 +0100
+++ b/mercurial/verify.py	Wed Mar 06 14:43:02 2019 +0100
@@ -334,8 +334,10 @@
             progress.complete()
 
         if self.havemf:
-            for c, m in sorted([(c, m) for m in mflinkrevs
-                        for c in mflinkrevs[m]]):
+            # since we delete entry in `mflinkrevs` during iteration, any
+            # remaining entries are "missing". We need to issue errors for them.
+            changesetpairs = [(c, m) for m in mflinkrevs for c in mflinkrevs[m]]
+            for c, m in sorted(changesetpairs):
                 if dir:
                     self._err(c, _("parent-directory manifest refers to unknown"
                                    " revision %s") % short(m), label)