| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -212,19 +212,19 @@ def iter_change_type(self, change_type: Lit_change_type) -> Iterator[T_Diff]: | |||
| 212 | 212 | if change_type not in self.change_type: | |
| 213 | 213 | raise ValueError("Invalid change type: %s" % change_type) | |
| 214 | 214 | ||
| 215 | - for diff in self: | ||
| 216 | - if diff.change_type == change_type: | ||
| 217 | - yield diff | ||
| 218 | - elif change_type == "A" and diff.new_file: | ||
| 219 | - yield diff | ||
| 220 | - elif change_type == "D" and diff.deleted_file: | ||
| 221 | - yield diff | ||
| 222 | - elif change_type == "C" and diff.copied_file: | ||
| 223 | - yield diff | ||
| 224 | - elif change_type == "R" and diff.renamed: | ||
| 225 | - yield diff | ||
| 226 | - elif change_type == "M" and diff.a_blob and diff.b_blob and diff.a_blob != diff.b_blob: | ||
| 227 | - yield diff | ||
| 215 | + for diffidx in self: | ||
| 216 | + if diffidx.change_type == change_type: | ||
| 217 | + yield diffidx | ||
| 218 | + elif change_type == "A" and diffidx.new_file: | ||
| 219 | + yield diffidx | ||
| 220 | + elif change_type == "D" and diffidx.deleted_file: | ||
| 221 | + yield diffidx | ||
| 222 | + elif change_type == "C" and diffidx.copied_file: | ||
| 223 | + yield diffidx | ||
| 224 | + elif change_type == "R" and diffidx.renamed: | ||
| 225 | + yield diffidx | ||
| 226 | + elif change_type == "M" and diffidx.a_blob and diffidx.b_blob and diffidx.a_blob != diffidx.b_blob: | ||
| 227 | + yield diffidx | ||
| 228 | 228 | # END for each diff | |
| 229 | 229 | ||
| 230 | 230 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,7 +41,7 @@ | |||
| 41 | 41 | from gitdb.base import IStream | |
| 42 | 42 | from gitdb.db import MemoryDB | |
| 43 | 43 | ||
| 44 | - import git.diff as diff | ||
| 44 | + import git.diff as git_diff | ||
| 45 | 45 | import os.path as osp | |
| 46 | 46 | ||
| 47 | 47 | from .fun import ( | |
@@ -88,7 +88,7 @@ | |||
| 88 | 88 | __all__ = ('IndexFile', 'CheckoutError') | |
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | - class IndexFile(LazyMixin, diff.Diffable, Serializable): | ||
| 91 | + class IndexFile(LazyMixin, git_diff.Diffable, Serializable): | ||
| 92 | 92 | ||
| 93 | 93 | """ | |
| 94 | 94 | Implements an Index that can be manipulated using a native implementation in | |
@@ -575,8 +575,8 @@ def write_tree(self) -> Tree: | |||
| 575 | 575 | root_tree._cache = tree_items # type: ignore | |
| 576 | 576 | return root_tree | |
| 577 | 577 | ||
| 578 | - def _process_diff_args(self, args: List[Union[str, diff.Diffable, object]] | ||
| 579 | - ) -> List[Union[str, diff.Diffable, object]]: | ||
| 578 | + def _process_diff_args(self, args: List[Union[str, git_diff.Diffable, object]] | ||
| 579 | + ) -> List[Union[str, git_diff.Diffable, object]]: | ||
| 580 | 580 | try: | |
| 581 | 581 | args.pop(args.index(self)) | |
| 582 | 582 | except IndexError: | |
@@ -1272,10 +1272,11 @@ def reset(self, commit: Union[Commit, 'Reference', str] = 'HEAD', working_tree: | |||
| 1272 | 1272 | return self | |
| 1273 | 1273 | ||
| 1274 | 1274 | @ default_index | |
| 1275 | - def diff(self, other: Union[diff.Diffable.Index, 'IndexFile.Index', Treeish, None, object] = diff.Diffable.Index, | ||
| 1275 | + def diff(self, | ||
| 1276 | + other: Union[git_diff.Diffable.Index, 'IndexFile.Index', Treeish, None, object] = git_diff.Diffable.Index, | ||
| 1276 | 1277 | paths: Union[str, List[PathLike], Tuple[PathLike, ...], None] = None, | |
| 1277 | 1278 | create_patch: bool = False, **kwargs: Any | |
| 1278 | - ) -> diff.DiffIndex: | ||
| 1279 | + ) -> git_diff.DiffIndex: | ||
| 1279 | 1280 | """Diff this index against the working copy or a Tree or Commit object | |
| 1280 | 1281 | ||
| 1281 | 1282 | For a documentation of the parameters and return values, see, | |
@@ -1287,7 +1288,7 @@ def diff(self, other: Union[diff.Diffable.Index, 'IndexFile.Index', Treeish, Non | |||
| 1287 | 1288 | """ | |
| 1288 | 1289 | # index against index is always empty | |
| 1289 | 1290 | if other is self.Index: | |
| 1290 | - return diff.DiffIndex() | ||
| 1291 | + return git_diff.DiffIndex() | ||
| 1291 | 1292 | ||
| 1292 | 1293 | # index against anything but None is a reverse diff with the respective | |
| 1293 | 1294 | # item. Handle existing -R flags properly. Transform strings to the object | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,7 @@ | |||
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | 6 | ||
| 7 | 7 | from git.util import IterableList, join_path | |
| 8 | - import git.diff as diff | ||
| 8 | + import git.diff as git_diff | ||
| 9 | 9 | from git.util import to_bin_sha | |
| 10 | 10 | ||
| 11 | 11 | from . import util | |
@@ -180,7 +180,7 @@ def __delitem__(self, name: str) -> None: | |||
| 180 | 180 | #} END mutators | |
| 181 | 181 | ||
| 182 | 182 | ||
| 183 | - class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable): | ||
| 183 | + class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): | ||
| 184 | 184 | ||
| 185 | 185 | """Tree objects represent an ordered list of Blobs and other Trees. | |
| 186 | 186 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -469,7 +469,7 @@ def __getattr__(self, attr: str) -> Any: | |||
| 469 | 469 | def _config_section_name(self) -> str: | |
| 470 | 470 | return 'remote "%s"' % self.name | |
| 471 | 471 | ||
| 472 | - def _set_cache_(self, attr: str) -> Any: | ||
| 472 | + def _set_cache_(self, attr: str) -> None: | ||
| 473 | 473 | if attr == "_config_reader": | |
| 474 | 474 | # NOTE: This is cached as __getattr__ is overridden to return remote config values implicitly, such as | |
| 475 | 475 | # in print(r.pushurl) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments