Compare commits
	
		
			No commits in common. "master" and "0.1.2" have entirely different histories.
		
	
	
		
	
		
| @ -3,12 +3,7 @@ from typing import Iterator | ||||
| 
 | ||||
| 
 | ||||
| def subprocess_readlines(cmd, cwd=None) -> Iterator[str]: | ||||
|     process = subprocess.Popen(cmd, | ||||
|                                cwd=cwd, | ||||
|                                stdout=subprocess.PIPE, | ||||
|                                text=True, | ||||
|                                encoding='utf-8', | ||||
|                                errors='replace') | ||||
|     process = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, text=True) | ||||
| 
 | ||||
|     for line in process.stdout: | ||||
|         line = line.rstrip('\n') | ||||
|  | ||||
| @ -29,7 +29,7 @@ class ShiftedLines(Sized, Iterable): | ||||
| 
 | ||||
| class LineShiftChecker: | ||||
|     SUBMODULE_MODE = '160000' | ||||
|     DIFF_BLOCK_REGEX = r'@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@' | ||||
|     DIFF_BLOCK_REGEX = r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@' | ||||
| 
 | ||||
|     def __init__(self, revision_since: str, revision_until: str) -> None: | ||||
|         self.revision_since = revision_since | ||||
| @ -55,8 +55,8 @@ class LineShiftChecker: | ||||
|         for line in process_output: | ||||
|             matches = re.search(LineShiftChecker.DIFF_BLOCK_REGEX, line) | ||||
|             if matches: | ||||
|                 diff_block_src_start = max(int(matches.group(1)), 1)  # line number should never be 0 | ||||
|                 diff_block_dst_start = max(int(matches.group(2)), 1)  # line number should never be 0 | ||||
|                 diff_block_src_start = int(matches.group(1)) | ||||
|                 diff_block_dst_start = int(matches.group(3)) | ||||
| 
 | ||||
|                 # fill shifted lines between 2 diff blocks | ||||
|                 for i in range(0, diff_block_src_start - src_line_index): | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user