##// END OF EJS Templates
verify: check the subrepository references in .hgsubstate...
Matt Harbison -
r25591:f1d46075 default
parent child Browse files
Show More
@@ -664,7 +664,28 b' def revert(repo, node, choose):'
664 664
665 665 def verify(repo):
666 666 """verify the consistency of a repository"""
667 return verifymod.verify(repo)
667 ret = verifymod.verify(repo)
668
669 # Broken subrepo references in hidden csets don't seem worth worrying about,
670 # since they can't be pushed/pulled, and --hidden can be used if they are a
671 # concern.
672
673 # pathto() is needed for -R case
674 revs = repo.revs("filelog(%s)",
675 util.pathto(repo.root, repo.getcwd(), '.hgsubstate'))
676
677 if revs:
678 repo.ui.status(_('checking subrepo links\n'))
679 for rev in revs:
680 ctx = repo[rev]
681 try:
682 for subpath in ctx.substate:
683 ret = ctx.sub(subpath).verify() or ret
684 except Exception:
685 repo.ui.warn(_('.hgsubstate is corrupt in revision %s\n') %
686 node.short(ctx.node()))
687
688 return ret
668 689
669 690 def remoteui(src, opts):
670 691 'build a remote ui from ui or repo and opts'
@@ -572,6 +572,12 b' class abstractsubrepo(object):'
572 572 def shortid(self, revid):
573 573 return revid
574 574
575 def verify(self):
576 '''verify the integrity of the repository. Return 0 on success or
577 warning, 1 on any error.
578 '''
579 return 0
580
575 581 @propertycache
576 582 def wvfs(self):
577 583 """return vfs to access the working directory of this subrepository
@@ -1011,6 +1017,24 b' class hgsubrepo(abstractsubrepo):'
1011 1017 def shortid(self, revid):
1012 1018 return revid[:12]
1013 1019
1020 def verify(self):
1021 try:
1022 rev = self._state[1]
1023 ctx = self._repo.unfiltered()[rev]
1024 if ctx.hidden():
1025 # Since hidden revisions aren't pushed/pulled, it seems worth an
1026 # explicit warning.
1027 ui = self._repo.ui
1028 ui.warn(_("subrepo '%s' is hidden in revision %s\n") %
1029 (self._relpath, node.short(self._ctx.node())))
1030 return 0
1031 except error.RepoLookupError:
1032 # A missing subrepo revision may be a case of needing to pull it, so
1033 # don't treat this as an error.
1034 self._repo.ui.warn(_("subrepo '%s' not found in revision %s\n") %
1035 (self._relpath, node.short(self._ctx.node())))
1036 return 0
1037
1014 1038 @propertycache
1015 1039 def wvfs(self):
1016 1040 """return own wvfs for efficiency and consitency
@@ -129,6 +129,7 b' test with "/" URI (issue747) and subrepo'
129 129 crosschecking files in changesets and manifests
130 130 checking files
131 131 3 files, 1 changesets, 3 total revisions
132 checking subrepo links
132 133 $ cat a
133 134 a
134 135 $ hg paths
@@ -106,4 +106,19 b' check that --hidden is propagated to the'
106 106 $ hg --hidden cat subrepo/a
107 107 foo
108 108
109 verify will warn if locked-in subrepo revisions are hidden or missing
110
111 $ hg ci -m "amended subrepo (again)"
112 $ hg --config extensions.strip= --hidden strip -R subrepo -qr 'tip'
113 $ hg verify
114 checking changesets
115 checking manifests
116 crosschecking files in changesets and manifests
117 checking files
118 2 files, 5 changesets, 5 total revisions
119 checking subrepo links
120 subrepo 'subrepo' is hidden in revision a66de08943b6
121 subrepo 'subrepo' is hidden in revision 674d05939c1e
122 subrepo 'subrepo' not found in revision a7d05d9055a4
123
109 124 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now