Пример #1
0
def fix_delta_ref(repo_dir, rev, bad_rev, bad_offset, bad_size):
  """Fix a "DELTA <REV> <OFFSET> <SIZE>" line in the revision file for REV
     in REPO_DIR, where <OFFSET> is wrong."""
  good_offset = find_good_rep_header(repo_dir, bad_rev, bad_size)
  old_line = ' '.join(['DELTA', bad_rev, bad_offset, bad_size])
  new_line = ' '.join(['DELTA', bad_rev, good_offset, bad_size])
  print "Fixing delta ref:", old_line, "->", new_line
  replace_in_rev_file(repo_dir, rev, old_line, new_line)
Пример #2
0
def fix_rep_ref(repo_dir, rev, prefix, rep_rev, bad_offset, rep_size):
  """Fix a "DELTA <REP_REV> <BAD_OFFSET> <REP_SIZE>"
        or "text: <REP_REV> <BAD_OFFSET> <REP_SIZE> ..."
     line in the revision file for REV in REPO_DIR, where <BAD_OFFSET> is
     wrong.  PREFIX is 'DELTA' or 'text:'.
  """
  good_offset = find_good_rep_header(repo_dir, rep_rev, rep_size)
  old_line = ' '.join([prefix, rep_rev, bad_offset, rep_size])
  new_line = ' '.join([prefix, rep_rev, good_offset, rep_size])
  if good_offset == bad_offset:
    raise FixError("Attempting to fix a rep ref that appears to be correct: " + old_line)
  replace_in_rev_file(repo_dir, rev, old_line, new_line)
  print("Fixed rep ref:", old_line, "->", new_line)