mercurial/subrepo.py
changeset 25591 f1d46075b13a
parent 25572 3d8c044ed513
child 25600 70ac1868b707
--- a/mercurial/subrepo.py	Sun Jun 14 22:04:17 2015 -0400
+++ b/mercurial/subrepo.py	Tue Jun 16 16:15:15 2015 -0400
@@ -572,6 +572,12 @@
     def shortid(self, revid):
         return revid
 
+    def verify(self):
+        '''verify the integrity of the repository.  Return 0 on success or
+        warning, 1 on any error.
+        '''
+        return 0
+
     @propertycache
     def wvfs(self):
         """return vfs to access the working directory of this subrepository
@@ -1011,6 +1017,24 @@
     def shortid(self, revid):
         return revid[:12]
 
+    def verify(self):
+        try:
+            rev = self._state[1]
+            ctx = self._repo.unfiltered()[rev]
+            if ctx.hidden():
+                # Since hidden revisions aren't pushed/pulled, it seems worth an
+                # explicit warning.
+                ui = self._repo.ui
+                ui.warn(_("subrepo '%s' is hidden in revision %s\n") %
+                        (self._relpath, node.short(self._ctx.node())))
+            return 0
+        except error.RepoLookupError:
+            # A missing subrepo revision may be a case of needing to pull it, so
+            # don't treat this as an error.
+            self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") %
+                               (self._relpath, node.short(self._ctx.node())))
+            return 0
+
     @propertycache
     def wvfs(self):
         """return own wvfs for efficiency and consitency