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

Commitb833eeb

Browse files
authored
Update tag.py
1 parent464848e commitb833eeb

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎git/refs/tag.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
# typing ------------------------------------------------------------------
66

7-
fromtypingimportAny,Union,TYPE_CHECKING
7+
fromtypingimportAny,Type,Union,TYPE_CHECKING
88
fromgit.typesimportCommit_ish,PathLike
99

1010
ifTYPE_CHECKING:
1111
fromgit.repoimportRepo
1212
fromgit.objectsimportCommit
1313
fromgit.objectsimportTagObject
14+
fromgit.refsimportSymbolicReference
1415

1516

1617
# ------------------------------------------------------------------------------
@@ -68,7 +69,8 @@ def object(self) -> Commit_ish: # type: ignore[override]
6869
returnReference._get_object(self)
6970

7071
@classmethod
71-
defcreate(cls,repo:'Repo',path:PathLike,reference:Union[Commit_ish,str]='HEAD',
72+
defcreate(cls:Type['TagReference'],repo:'Repo',path:PathLike,
73+
reference:Union[str,'SymbolicReference']='HEAD',
7274
logmsg:Union[str,None]=None,
7375
force:bool=False,**kwargs:Any)->'TagReference':
7476
"""Create a new tag reference.
@@ -78,7 +80,7 @@ def create(cls, repo: 'Repo', path: PathLike, reference: Union[Commit_ish, str]
7880
The prefix refs/tags is implied
7981
8082
:param ref:
81-
A reference to theobject you want to tag.It can be a commit, tree or
83+
A reference to theObject you want to tag.The Object can be a commit, tree or
8284
blob.
8385
8486
:param logmsg:
@@ -98,7 +100,9 @@ def create(cls, repo: 'Repo', path: PathLike, reference: Union[Commit_ish, str]
98100
Additional keyword arguments to be passed to git-tag
99101
100102
:return: A new TagReference"""
101-
args= (path,reference)
103+
if'ref'inkwargsandkwargs['ref']:
104+
reference=kwargs['ref']
105+
102106
iflogmsg:
103107
kwargs['m']=logmsg
104108
elif'message'inkwargsandkwargs['message']:
@@ -107,11 +111,13 @@ def create(cls, repo: 'Repo', path: PathLike, reference: Union[Commit_ish, str]
107111
ifforce:
108112
kwargs['f']=True
109113

114+
args= (path,reference)
115+
110116
repo.git.tag(*args,**kwargs)
111117
returnTagReference(repo,"%s/%s"% (cls._common_path_default,path))
112118

113119
@classmethod
114-
defdelete(cls,repo:'Repo',*tags:'TagReference')->None:
120+
defdelete(cls,repo:'Repo',*tags:'TagReference')->None:# type: ignore[override]
115121
"""Delete the given existing tag or tags"""
116122
repo.git.tag("-d",*tags)
117123

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp