Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdeafa6a

Browse files
committed
Fix for mrepo2
1 parent278a371 commitdeafa6a

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

‎git/diff.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def _handle_diff_line(lines_bytes: bytes, repo: 'Repo', index: DiffIndex) -> Non
512512
# R: status letter
513513
# 100: score (in case of copy and rename)
514514

515-
assertis_change_type(_change_type[0])
515+
assertis_change_type(_change_type[0]),"Unexpected _change_type recieved in Diff"
516516
change_type:Lit_change_type=_change_type[0]
517517
score_str=''.join(_change_type[1:])
518518
score=int(score_str)ifscore_str.isdigit()elseNone

‎git/objects/submodule/base.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ def add(cls, repo: 'Repo', name: str, path: PathLike, url: Union[str, None] = No
474474
sm._branch_path=br.path
475475

476476
# we deliberately assume that our head matches our index !
477-
ifmrepoisnotNone:
478-
sm.binsha=mrepo.head.commit.binsha
477+
mrepo=cast('Repo',mrepo)
478+
sm.binsha=mrepo.head.commit.binsha
479479
index.add([sm],write=True)
480480

481481
returnsm
@@ -652,7 +652,7 @@ def update(self, recursive: bool = False, init: bool = True, to_latest_revision:
652652
may_reset=True
653653
ifmrepo.head.commit.binsha!=self.NULL_BIN_SHA:
654654
base_commit=mrepo.merge_base(mrepo.head.commit,hexsha)
655-
iflen(base_commit)==0or(base_commit[0]isnotNoneandbase_commit[0].hexsha==hexsha):
655+
iflen(base_commit)==0orbase_commit[0].hexsha==hexsha:# type: ignore
656656
ifforce:
657657
msg="Will force checkout or reset on local branch that is possibly in the future of"
658658
msg+="the commit it will be checked out to, effectively 'forgetting' new commits"
@@ -927,7 +927,7 @@ def remove(self, module: bool = True, force: bool = False,
927927
importgc
928928
gc.collect()
929929
try:
930-
rmtree(str(wtd))
930+
rmtree(wtd)# type: ignore ##str()?
931931
exceptExceptionasex:
932932
ifHIDE_WINDOWS_KNOWN_ERRORS:
933933
raiseSkipTest("FIXME: fails with: PermissionError\n {}".format(ex))fromex
@@ -1015,7 +1015,7 @@ def set_parent_commit(self, commit: Union[Commit_ish, None], check: bool = True)
10151015
# If check is False, we might see a parent-commit that doesn't even contain the submodule anymore.
10161016
# in that case, mark our sha as being NULL
10171017
try:
1018-
self.binsha=pctree[str(self.path)].binsha
1018+
self.binsha=pctree[self.path].binsha# type: ignore # str()?
10191019
exceptKeyError:
10201020
self.binsha=self.NULL_BIN_SHA
10211021
# end
@@ -1080,7 +1080,7 @@ def rename(self, new_name: str) -> 'Submodule':
10801080
destination_module_abspath=self._module_abspath(self.repo,self.path,new_name)
10811081
source_dir=mod.git_dir
10821082
# Let's be sure the submodule name is not so obviously tied to a directory
1083-
ifstr(destination_module_abspath).startswith(str(mod.git_dir)):
1083+
ifdestination_module_abspath.startswith(str(mod.git_dir)):# type: ignore # str()?
10841084
tmp_dir=self._module_abspath(self.repo,self.path,str(uuid.uuid4()))
10851085
os.renames(source_dir,tmp_dir)
10861086
source_dir=tmp_dir

‎git/repo/base.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ def init(cls, path: PathLike = None, mkdir: bool = True, odbt: Type[GitCmdObject
10161016

10171017
@classmethod
10181018
def_clone(cls,git:'Git',url:PathLike,path:PathLike,odb_default_type:Type[GitCmdObjectDB],
1019-
progress:Union['RemoteProgress','UpdateProgress',Callable[...,'RemoteProgress'],None],
1019+
progress:Union['RemoteProgress','UpdateProgress',Callable[...,'RemoteProgress'],None]=None,
10201020
multi_options:Optional[List[str]]=None,**kwargs:Any
10211021
)->'Repo':
10221022
odbt=kwargs.pop('odbt',odb_default_type)

‎git/types.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importos
66
importsys
77
fromtypingimport (Callable,Dict,NoReturn,Tuple,Union,Any,Iterator,# noqa: F401
8-
NamedTuple,TYPE_CHECKING,TypeVar)# noqa: F401
8+
NamedTuple,TYPE_CHECKING,TypeVar,runtime_checkable)# noqa: F401
99

1010

1111
ifsys.version_info[:2]>= (3,8):
@@ -78,3 +78,11 @@ class Total_TD(TypedDict):
7878
classHSH_TD(TypedDict):
7979
total:Total_TD
8080
files:Dict[PathLike,Files_TD]
81+
82+
83+
@runtime_checkable
84+
classRepoLike(Protocol):
85+
"""Protocol class to allow structural type-checking of Repo
86+
e.g. when cannot import due to circular imports"""
87+
88+
defremotes(self): ...# NOQA: E704

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp