summaryrefslogtreecommitdiff
path: root/continuedev/src
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-08-01 00:37:24 -0700
committerNate Sesti <sestinj@gmail.com>2023-08-01 00:37:24 -0700
commit70eb274f51c703c352865b8af39557b271fae6dd (patch)
tree021eda9b05fac39b3f046eb41ab3fc5c0df7ede5 /continuedev/src
parent1295cc00950c9c6b711fc82ef5492448a1be8caf (diff)
downloadsncontinue-70eb274f51c703c352865b8af39557b271fae6dd.tar.gz
sncontinue-70eb274f51c703c352865b8af39557b271fae6dd.tar.bz2
sncontinue-70eb274f51c703c352865b8af39557b271fae6dd.zip
try cx_freeze, smaller pyinstaller
Diffstat (limited to 'continuedev/src')
-rw-r--r--continuedev/src/continuedev/libs/util/calculate_diff.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/continuedev/src/continuedev/libs/util/calculate_diff.py b/continuedev/src/continuedev/libs/util/calculate_diff.py
index 3e82bab3..e8e48839 100644
--- a/continuedev/src/continuedev/libs/util/calculate_diff.py
+++ b/continuedev/src/continuedev/libs/util/calculate_diff.py
@@ -2,41 +2,6 @@ import difflib
from typing import List
from ...models.main import Position, Range
from ...models.filesystem import FileEdit
-from diff_match_patch import diff_match_patch
-
-
-def calculate_diff_match_patch(filepath: str, original: str, updated: str) -> List[FileEdit]:
- dmp = diff_match_patch()
- diffs = dmp.diff_main(original, updated)
- dmp.diff_cleanupSemantic(diffs)
-
- replacements = []
-
- current_index = 0
- deleted_length = 0
-
- for diff in diffs:
- if diff[0] == diff_match_patch.DIFF_EQUAL:
- current_index += len(diff[1])
- deleted_length = 0
- elif diff[0] == diff_match_patch.DIFF_INSERT:
- current_index += deleted_length
- replacements.append((current_index, current_index, diff[1]))
- current_index += len(diff[1])
- deleted_length = 0
- elif diff[0] == diff_match_patch.DIFF_DELETE:
- replacements.append(
- (current_index, current_index + len(diff[1]), ''))
- deleted_length += len(diff[1])
- elif diff[0] == diff_match_patch.DIFF_REPLACE:
- replacements.append(
- (current_index, current_index + len(diff[1]), ''))
- current_index += deleted_length
- replacements.append((current_index, current_index, diff[2]))
- current_index += len(diff[2])
- deleted_length = 0
-
- return [FileEdit(filepath=filepath, range=Range.from_indices(original, r[0], r[1]), replacement=r[2]) for r in replacements]
def calculate_diff(filepath: str, original: str, updated: str) -> List[FileEdit]: