MCPcopy Create free account
hub / github.com/danvk/webdiff / from_diff_raw_line

Method from_diff_raw_line

webdiff/localfilediff.py:50–60  ·  view source on GitHub ↗
(line: RawDiffLine, a_dir: str, b_dir: str)

Source from the content-addressed store, hash-verified

48
49 @staticmethod
50 def from_diff_raw_line(line: RawDiffLine, a_dir: str, b_dir: str):
51 status = line.status
52 # A, C (copy), D, M, R, T (change in type), U (unmerged), X (bug)
53 if status == 'A':
54 return LocalFileDiff(a_dir, '', b_dir, line.path, is_move=False, num_add=line.num_add, num_delete=line.num_delete)
55 if status == 'D':
56 return LocalFileDiff(a_dir, line.path, b_dir, '', is_move=False, num_add=line.num_add, num_delete=line.num_delete)
57 if line.dst_path:
58 return LocalFileDiff(a_dir, line.path, b_dir, line.dst_path, is_move=True, num_add=line.num_add, num_delete=line.num_delete)
59 dst_path = os.path.join(b_dir, os.path.relpath(line.path, a_dir))
60 return LocalFileDiff(a_dir, line.path, b_dir, dst_path, is_move=False, num_add=line.num_add, num_delete=line.num_delete)

Callers 1

gitdiffFunction · 0.80

Calls 1

LocalFileDiffClass · 0.85

Tested by

no test coverage detected