| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -386,13 +386,13 @@ def aggressive_tree_merge(odb, tree_shas: Sequence[bytes]) -> List[BaseIndexEntr | |||
| 386 | 386 | # END handle ours | |
| 387 | 387 | else: | |
| 388 | 388 | # all three can't be None | |
| 389 | - if ours is None and theirs is not None: | ||
| 389 | + if ours is None: | ||
| 390 | 390 | # added in their branch | |
| 391 | - out.append(_tree_entry_to_baseindexentry(theirs, 0)) | ||
| 392 | - elif theirs is None and ours is not None: | ||
| 391 | + out.append(_tree_entry_to_baseindexentry(theirs, 0)) # type: ignore | ||
| 392 | + elif theirs is None: # ours is not None, theirs is None | ||
| 393 | 393 | # added in our branch | |
| 394 | 394 | out.append(_tree_entry_to_baseindexentry(ours, 0)) | |
| 395 | - elif ours is not None and theirs is not None: | ||
| 395 | + else: | ||
| 396 | 396 | # both have it, except for the base, see whether it changed | |
| 397 | 397 | if ours[0] != theirs[0] or ours[1] != theirs[1]: | |
| 398 | 398 | out.append(_tree_entry_to_baseindexentry(ours, 2)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,13 +102,13 @@ def tree_entries_from_data(data: bytes) -> List[EntryTup]: | |||
| 102 | 102 | return out | |
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | - def _find_by_name(tree_data: Sequence[EntryTupOrNone], name: str, is_dir: bool, start_at: int | ||
| 105 | + def _find_by_name(tree_data: List[EntryTupOrNone], name: str, is_dir: bool, start_at: int | ||
| 106 | 106 | ) -> EntryTupOrNone: | |
| 107 | 107 | """return data entry matching the given name and tree mode | |
| 108 | 108 | or None. | |
| 109 | 109 | Before the item is returned, the respective data item is set | |
| 110 | 110 | None in the tree_data list to mark it done""" | |
| 111 | - tree_data_list: List[EntryTupOrNone] = list(tree_data) | ||
| 111 | + tree_data_list: List[EntryTupOrNone] = tree_data | ||
| 112 | 112 | try: | |
| 113 | 113 | item = tree_data_list[start_at] | |
| 114 | 114 | if item and item[2] == name and S_ISDIR(item[1]) == is_dir: | |
@@ -160,6 +160,7 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by | |||
| 160 | 160 | set it '' for the first iteration | |
| 161 | 161 | :note: The ordering of the returned items will be partially lost""" | |
| 162 | 162 | trees_data: List[List[EntryTupOrNone]] = [] | |
| 163 | + | ||
| 163 | 164 | nt = len(tree_shas) | |
| 164 | 165 | for tree_sha in tree_shas: | |
| 165 | 166 | if tree_sha is None: | |
@@ -193,8 +194,7 @@ def traverse_trees_recursive(odb: 'GitCmdObjectDB', tree_shas: Sequence[Union[by | |||
| 193 | 194 | # ti+nt, not ti+1+nt | |
| 194 | 195 | for tio in range(ti + 1, ti + nt): | |
| 195 | 196 | tio = tio % nt | |
| 196 | - td = trees_data[tio] | ||
| 197 | - entries[tio] = _find_by_name(td, name, is_dir, ii) | ||
| 197 | + entries[tio] = _find_by_name(trees_data[tio], name, is_dir, ii) | ||
| 198 | 198 | ||
| 199 | 199 | # END for each other item data | |
| 200 | 200 | # if we are a directory, enter recursion | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,7 +44,7 @@ | |||
| 44 | 44 | ||
| 45 | 45 | def git_cmp(t1: TreeCacheTup, t2: TreeCacheTup) -> int: | |
| 46 | 46 | a, b = t1[2], t2[2] | |
| 47 | - assert isinstance(a, str) and isinstance(b, str) # Need as mypy 9.0 cannot unpack TypeVar properly | ||
| 47 | + # assert isinstance(a, str) and isinstance(b, str) | ||
| 48 | 48 | len_a, len_b = len(a), len(b) | |
| 49 | 49 | min_len = min(len_a, len_b) | |
| 50 | 50 | min_cmp = cmp(a[:min_len], b[:min_len]) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments