Show More
@@ -1679,11 +1679,17 b' class localrepository(object):' | |||||
1679 | self.ui.warn(msg + "\n") |
|
1679 | self.ui.warn(msg + "\n") | |
1680 | errors[0] += 1 |
|
1680 | errors[0] += 1 | |
1681 |
|
1681 | |||
|
1682 | def checksize(obj, name): | |||
|
1683 | d = obj.checksize() | |||
|
1684 | if d[0]: | |||
|
1685 | err(_("%s data length off by %d bytes") % (name, d[0])) | |||
|
1686 | if d[1]: | |||
|
1687 | err(_("%s index contains %d extra bytes") % (name, d[1])) | |||
|
1688 | ||||
1682 | seen = {} |
|
1689 | seen = {} | |
1683 | self.ui.status(_("checking changesets\n")) |
|
1690 | self.ui.status(_("checking changesets\n")) | |
1684 |
|
|
1691 | checksize(self.changelog, "changelog") | |
1685 | if d: |
|
1692 | ||
1686 | err(_("changeset data short %d bytes") % d) |
|
|||
1687 | for i in range(self.changelog.count()): |
|
1693 | for i in range(self.changelog.count()): | |
1688 | changesets += 1 |
|
1694 | changesets += 1 | |
1689 | n = self.changelog.node(i) |
|
1695 | n = self.changelog.node(i) | |
@@ -1713,9 +1719,8 b' class localrepository(object):' | |||||
1713 |
|
1719 | |||
1714 | seen = {} |
|
1720 | seen = {} | |
1715 | self.ui.status(_("checking manifests\n")) |
|
1721 | self.ui.status(_("checking manifests\n")) | |
1716 | d = self.manifest.checksize() |
|
1722 | checksize(self.manifest, "manifest") | |
1717 | if d: |
|
1723 | ||
1718 | err(_("manifest data short %d bytes") % d) |
|
|||
1719 | for i in range(self.manifest.count()): |
|
1724 | for i in range(self.manifest.count()): | |
1720 | n = self.manifest.node(i) |
|
1725 | n = self.manifest.node(i) | |
1721 | l = self.manifest.linkrev(n) |
|
1726 | l = self.manifest.linkrev(n) | |
@@ -1771,9 +1776,7 b' class localrepository(object):' | |||||
1771 | continue |
|
1776 | continue | |
1772 | files += 1 |
|
1777 | files += 1 | |
1773 | fl = self.file(f) |
|
1778 | fl = self.file(f) | |
1774 |
|
|
1779 | checksize(fl, f) | |
1775 | if d: |
|
|||
1776 | err(_("%s file data short %d bytes") % (f, d)) |
|
|||
1777 |
|
1780 | |||
1778 | nodes = {nullid: 1} |
|
1781 | nodes = {nullid: 1} | |
1779 | seen = {} |
|
1782 | seen = {} |
@@ -213,7 +213,7 b' class revlog(object):' | |||||
213 | m = [None] * l |
|
213 | m = [None] * l | |
214 |
|
214 | |||
215 | n = 0 |
|
215 | n = 0 | |
216 |
for f in xrange(0, l |
|
216 | for f in xrange(0, l * s, s): | |
217 | # offset, size, base, linkrev, p1, p2, nodeid |
|
217 | # offset, size, base, linkrev, p1, p2, nodeid | |
218 | e = struct.unpack(indexformat, i[f:f + s]) |
|
218 | e = struct.unpack(indexformat, i[f:f + s]) | |
219 | m[n] = (e[6], n) |
|
219 | m[n] = (e[6], n) | |
@@ -841,14 +841,29 b' class revlog(object):' | |||||
841 | expected = 0 |
|
841 | expected = 0 | |
842 | if self.count(): |
|
842 | if self.count(): | |
843 | expected = self.end(self.count() - 1) |
|
843 | expected = self.end(self.count() - 1) | |
|
844 | ||||
844 | try: |
|
845 | try: | |
845 | f = self.opener(self.datafile) |
|
846 | f = self.opener(self.datafile) | |
846 | f.seek(0, 2) |
|
847 | f.seek(0, 2) | |
847 | actual = f.tell() |
|
848 | actual = f.tell() | |
848 |
|
|
849 | dd = actual - expected | |
849 | except IOError, inst: |
|
850 | except IOError, inst: | |
850 |
if inst.errno |
|
851 | if inst.errno != errno.ENOENT: | |
851 |
re |
|
852 | raise | |
852 |
|
|
853 | dd = 0 | |
|
854 | ||||
|
855 | try: | |||
|
856 | f = self.opener(self.indexfile) | |||
|
857 | f.seek(0, 2) | |||
|
858 | actual = f.tell() | |||
|
859 | s = struct.calcsize(indexformat) | |||
|
860 | i = actual / s | |||
|
861 | di = actual - (i * s) | |||
|
862 | except IOError, inst: | |||
|
863 | if inst.errno != errno.ENOENT: | |||
|
864 | raise | |||
|
865 | di = 0 | |||
|
866 | ||||
|
867 | return (dd, di) | |||
853 |
|
868 | |||
854 |
|
869 |
General Comments 0
You need to be logged in to leave comments.
Login now