##// END OF EJS Templates
verify: document corner cases...
Jun Wu -
r31761:b044c339 default
parent child Browse files
Show More
@@ -379,7 +379,53 b' class verifier(object):'
379 else:
379 else:
380 del filenodes[f][n]
380 del filenodes[f][n]
381
381
382 # verify contents
382 # Verify contents. 4 cases to care about:
383 #
384 # common: the most common case
385 # rename: with a rename
386 # meta: file content starts with b'\1\n', the metadata
387 # header defined in filelog.py, but without a rename
388 # ext: content stored externally
389 #
390 # More formally, their differences are shown below:
391 #
392 # | common | rename | meta | ext
393 # -------------------------------------------------------
394 # flags() | 0 | 0 | 0 | not 0
395 # renamed() | False | True | False | ?
396 # rawtext[0:2]=='\1\n'| False | True | True | ?
397 #
398 # "rawtext" means the raw text stored in revlog data, which
399 # could be retrieved by "revision(rev, raw=True)". "text"
400 # mentioned below is "revision(rev, raw=False)".
401 #
402 # There are 3 different lengths stored physically:
403 # 1. L1: rawsize, stored in revlog index
404 # 2. L2: len(rawtext), stored in revlog data
405 # 3. L3: len(text), stored in revlog data if flags==0, or
406 # possibly somewhere else if flags!=0
407 #
408 # L1 should be equal to L2. L3 could be different from them.
409 # "text" may or may not affect commit hash depending on flag
410 # processors (see revlog.addflagprocessor).
411 #
412 # | common | rename | meta | ext
413 # -------------------------------------------------
414 # rawsize() | L1 | L1 | L1 | L1
415 # size() | L1 | L2-LM | L1(*) | L1 (?)
416 # len(rawtext) | L2 | L2 | L2 | L2
417 # len(text) | L2 | L2 | L2 | L3
418 # len(read()) | L2 | L2-LM | L2-LM | L3 (?)
419 #
420 # LM: length of metadata, depending on rawtext
421 # (*): not ideal, see comment in filelog.size
422 # (?): could be "- len(meta)" if the resolved content has
423 # rename metadata
424 #
425 # Checks needed to be done:
426 # 1. length check: L1 == L2, in all cases.
427 # 2. hash check: depending on flag processor, we may need to
428 # use either "text" (external), or "rawtext" (in revlog).
383 try:
429 try:
384 l = len(fl.read(n))
430 l = len(fl.read(n))
385 rp = fl.renamed(n)
431 rp = fl.renamed(n)
General Comments 0
You need to be logged in to leave comments. Login now