Show More
@@ -0,0 +1,24 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | STRIP=`pwd` | |||
|
4 | ||||
|
5 | hg init test | |||
|
6 | cd test | |||
|
7 | cat > .hg/hgrc <<EOF | |||
|
8 | [server] | |||
|
9 | validate=1 | |||
|
10 | EOF | |||
|
11 | echo alpha > alpha | |||
|
12 | echo beta > beta | |||
|
13 | hg addr | |||
|
14 | hg ci -m 1 | |||
|
15 | ||||
|
16 | cd .. | |||
|
17 | hg clone test test-clone | |||
|
18 | ||||
|
19 | cd test-clone | |||
|
20 | cp .hg/store/data/beta.i tmp | |||
|
21 | echo blah >> beta | |||
|
22 | hg ci -m '2 (corrupt)' | |||
|
23 | mv tmp .hg/store/data/beta.i | |||
|
24 | hg push 2>&1 | sed "s%$STRIP%test-root%" |
@@ -0,0 +1,12 b'' | |||||
|
1 | adding alpha | |||
|
2 | adding beta | |||
|
3 | updating to branch default | |||
|
4 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
5 | pushing to test-root/test | |||
|
6 | searching for changes | |||
|
7 | adding changesets | |||
|
8 | adding manifests | |||
|
9 | adding file changes | |||
|
10 | transaction abort! | |||
|
11 | rollback completed | |||
|
12 | abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify |
@@ -2005,6 +2005,16 b' class localrepository(repo.repository):' | |||||
2005 | # be empty during the pull |
|
2005 | # be empty during the pull | |
2006 | self.manifest.addgroup(chunkiter, revmap, trp) |
|
2006 | self.manifest.addgroup(chunkiter, revmap, trp) | |
2007 |
|
2007 | |||
|
2008 | needfiles = {} | |||
|
2009 | if self.ui.configbool('server', 'validate', default=False): | |||
|
2010 | # validate incoming csets have their manifests | |||
|
2011 | for cset in xrange(clstart, clend): | |||
|
2012 | mfest = self.changelog.read(self.changelog.node(cset))[0] | |||
|
2013 | mfest = self.manifest.readdelta(mfest) | |||
|
2014 | # store file nodes we must see | |||
|
2015 | for f, n in mfest.iteritems(): | |||
|
2016 | needfiles.setdefault(f, set()).add(n) | |||
|
2017 | ||||
2008 | # process the files |
|
2018 | # process the files | |
2009 | self.ui.status(_("adding file changes\n")) |
|
2019 | self.ui.status(_("adding file changes\n")) | |
2010 | while 1: |
|
2020 | while 1: | |
@@ -2019,6 +2029,24 b' class localrepository(repo.repository):' | |||||
2019 | raise util.Abort(_("received file revlog group is empty")) |
|
2029 | raise util.Abort(_("received file revlog group is empty")) | |
2020 | revisions += len(fl) - o |
|
2030 | revisions += len(fl) - o | |
2021 | files += 1 |
|
2031 | files += 1 | |
|
2032 | if f in needfiles: | |||
|
2033 | needs = needfiles[f] | |||
|
2034 | for new in xrange(o, len(fl)): | |||
|
2035 | n = fl.node(new) | |||
|
2036 | if n in needs: | |||
|
2037 | needs.remove(n) | |||
|
2038 | if not needs: | |||
|
2039 | del needfiles[f] | |||
|
2040 | ||||
|
2041 | for f, needs in needfiles.iteritems(): | |||
|
2042 | fl = self.file(f) | |||
|
2043 | for n in needs: | |||
|
2044 | try: | |||
|
2045 | fl.rev(n) | |||
|
2046 | except error.LookupError: | |||
|
2047 | raise util.Abort( | |||
|
2048 | _('missing file data for %s:%s - run hg verify') % | |||
|
2049 | (f, hex(n))) | |||
2022 |
|
2050 | |||
2023 | newheads = len(cl.heads()) |
|
2051 | newheads = len(cl.heads()) | |
2024 | heads = "" |
|
2052 | heads = "" |
General Comments 0
You need to be logged in to leave comments.
Login now