comparison mercurial/verify.py @ 10698:e930017f9e2a stable

progress: use a verb (+noun) in present participle
author Martin Geisler <mg@lazybytes.net>
date Mon, 15 Mar 2010 18:33:39 +0100
parents 45734b51c99b
children 6ced27d3168a
comparison
equal deleted inserted replaced
10697:c90d923fff64 10698:e930017f9e2a
120 ui.status(_("checking changesets\n")) 120 ui.status(_("checking changesets\n"))
121 seen = {} 121 seen = {}
122 checklog(cl, "changelog", 0) 122 checklog(cl, "changelog", 0)
123 total = len(repo) 123 total = len(repo)
124 for i in repo: 124 for i in repo:
125 ui.progress(_('changelog'), i, total=total) 125 ui.progress(_('checking'), i, total=total)
126 n = cl.node(i) 126 n = cl.node(i)
127 checkentry(cl, i, n, seen, [i], "changelog") 127 checkentry(cl, i, n, seen, [i], "changelog")
128 128
129 try: 129 try:
130 changes = cl.read(n) 130 changes = cl.read(n)
131 mflinkrevs.setdefault(changes[0], []).append(i) 131 mflinkrevs.setdefault(changes[0], []).append(i)
132 for f in changes[3]: 132 for f in changes[3]:
133 filelinkrevs.setdefault(f, []).append(i) 133 filelinkrevs.setdefault(f, []).append(i)
134 except Exception, inst: 134 except Exception, inst:
135 exc(i, _("unpacking changeset %s") % short(n), inst) 135 exc(i, _("unpacking changeset %s") % short(n), inst)
136 ui.progress(_('changelog'), None) 136 ui.progress(_('checking'), None)
137 137
138 ui.status(_("checking manifests\n")) 138 ui.status(_("checking manifests\n"))
139 seen = {} 139 seen = {}
140 checklog(mf, "manifest", 0) 140 checklog(mf, "manifest", 0)
141 total = len(mf) 141 total = len(mf)
142 for i in mf: 142 for i in mf:
143 ui.progress(_('manifests'), i, total=total) 143 ui.progress(_('checking'), i, total=total)
144 n = mf.node(i) 144 n = mf.node(i)
145 lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest") 145 lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")
146 if n in mflinkrevs: 146 if n in mflinkrevs:
147 del mflinkrevs[n] 147 del mflinkrevs[n]
148 else: 148 else:
154 err(lr, _("file without name in manifest")) 154 err(lr, _("file without name in manifest"))
155 elif f != "/dev/null": 155 elif f != "/dev/null":
156 filenodes.setdefault(f, {}).setdefault(fn, lr) 156 filenodes.setdefault(f, {}).setdefault(fn, lr)
157 except Exception, inst: 157 except Exception, inst:
158 exc(lr, _("reading manifest delta %s") % short(n), inst) 158 exc(lr, _("reading manifest delta %s") % short(n), inst)
159 ui.progress(_('manifests'), None) 159 ui.progress(_('checking'), None)
160 160
161 ui.status(_("crosschecking files in changesets and manifests\n")) 161 ui.status(_("crosschecking files in changesets and manifests\n"))
162 162
163 total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes) 163 total = len(mflinkrevs) + len(filelinkrevs) + len(filenodes)
164 count = 0 164 count = 0
165 if havemf: 165 if havemf:
166 for c, m in sorted([(c, m) for m in mflinkrevs 166 for c, m in sorted([(c, m) for m in mflinkrevs
167 for c in mflinkrevs[m]]): 167 for c in mflinkrevs[m]]):
168 count += 1 168 count += 1
169 ui.progress(_('crosscheck'), count, total=total) 169 ui.progress(_('crosschecking'), count, total=total)
170 err(c, _("changeset refers to unknown manifest %s") % short(m)) 170 err(c, _("changeset refers to unknown manifest %s") % short(m))
171 mflinkrevs = None # del is bad here due to scope issues 171 mflinkrevs = None # del is bad here due to scope issues
172 172
173 for f in sorted(filelinkrevs): 173 for f in sorted(filelinkrevs):
174 count += 1 174 count += 1
175 ui.progress(_('crosscheck'), count, total=total) 175 ui.progress(_('crosschecking'), count, total=total)
176 if f not in filenodes: 176 if f not in filenodes:
177 lr = filelinkrevs[f][0] 177 lr = filelinkrevs[f][0]
178 err(lr, _("in changeset but not in manifest"), f) 178 err(lr, _("in changeset but not in manifest"), f)
179 179
180 if havecl: 180 if havecl:
181 for f in sorted(filenodes): 181 for f in sorted(filenodes):
182 count += 1 182 count += 1
183 ui.progress(_('crosscheck'), count, total=total) 183 ui.progress(_('crosschecking'), count, total=total)
184 if f not in filelinkrevs: 184 if f not in filelinkrevs:
185 try: 185 try:
186 fl = repo.file(f) 186 fl = repo.file(f)
187 lr = min([fl.linkrev(fl.rev(n)) for n in filenodes[f]]) 187 lr = min([fl.linkrev(fl.rev(n)) for n in filenodes[f]])
188 except: 188 except:
189 lr = None 189 lr = None
190 err(lr, _("in manifest but not in changeset"), f) 190 err(lr, _("in manifest but not in changeset"), f)
191 191
192 ui.progress(_('crosscheck'), None) 192 ui.progress(_('crosschecking'), None)
193 193
194 ui.status(_("checking files\n")) 194 ui.status(_("checking files\n"))
195 195
196 storefiles = set() 196 storefiles = set()
197 for f, f2, size in repo.store.datafiles(): 197 for f, f2, size in repo.store.datafiles():
201 storefiles.add(f) 201 storefiles.add(f)
202 202
203 files = sorted(set(filenodes) | set(filelinkrevs)) 203 files = sorted(set(filenodes) | set(filelinkrevs))
204 total = len(files) 204 total = len(files)
205 for i, f in enumerate(files): 205 for i, f in enumerate(files):
206 ui.progress(_('files'), i, item=f, total=total) 206 ui.progress(_('checking'), i, item=f, total=total)
207 try: 207 try:
208 linkrevs = filelinkrevs[f] 208 linkrevs = filelinkrevs[f]
209 except KeyError: 209 except KeyError:
210 # in manifest but not in changelog 210 # in manifest but not in changelog
211 linkrevs = [] 211 linkrevs = []
279 # cross-check 279 # cross-check
280 if f in filenodes: 280 if f in filenodes:
281 fns = [(lr, n) for n, lr in filenodes[f].iteritems()] 281 fns = [(lr, n) for n, lr in filenodes[f].iteritems()]
282 for lr, node in sorted(fns): 282 for lr, node in sorted(fns):
283 err(lr, _("%s in manifests not found") % short(node), f) 283 err(lr, _("%s in manifests not found") % short(node), f)
284 ui.progress(_('files'), None) 284 ui.progress(_('checking'), None)
285 285
286 for f in storefiles: 286 for f in storefiles:
287 warn(_("warning: orphan revlog '%s'") % f) 287 warn(_("warning: orphan revlog '%s'") % f)
288 288
289 ui.status(_("%d files, %d changesets, %d total revisions\n") % 289 ui.status(_("%d files, %d changesets, %d total revisions\n") %