@@ -17,7 +17,7 @@ from typing import (
17
17
overload ,
18
18
)
19
19
20
- from . import Index
20
+ from . import Index , IndexEntry
21
21
from ._libgit2 .ffi import (
22
22
GitCommitC ,
23
23
GitMergeOptionsC ,
@@ -28,7 +28,7 @@ from ._libgit2.ffi import (
28
28
_Pointer ,
29
29
)
30
30
from .blame import Blame
31
- from .callbacks import CheckoutCallbacks
31
+ from .callbacks import CheckoutCallbacks , StashApplyCallbacks
32
32
from .config import Config
33
33
from .enums import (
34
34
ApplyLocation ,
@@ -59,6 +59,7 @@ from .enums import (
59
59
SortMode ,
60
60
)
61
61
from .filter import Filter
62
+ from .index import MergeFileResult
62
63
from .packbuilder import PackBuilder
63
64
from .remotes import Remote
64
65
from .repository import BaseRepository
@@ -765,7 +766,9 @@ class Repository:
765
766
def _from_c (cls , ptr : 'GitRepositoryC' , owned : bool ) -> 'Repository' : ...
766
767
def __iter__ (self ) -> Iterator [Oid ]: ...
767
768
def __getitem__ (self , key : str | Oid ) -> Object : ...
768
- def add_worktree (self , name : str , path : str , ref : Reference = ...) -> Worktree : ...
769
+ def add_worktree (
770
+ self , name : str , path : str | Path , ref : Reference = ...
771
+ ) -> Worktree : ...
769
772
def amend_commit (
770
773
self ,
771
774
commit : Commit | Oid | str ,
@@ -797,13 +800,14 @@ class Repository:
797
800
) -> Blame : ...
798
801
def checkout (
799
802
self ,
800
- refname : Optional [ _OidArg ] ,
803
+ refname : _OidArg | None | Reference = None ,
801
804
* ,
802
805
strategy : CheckoutStrategy | None = None ,
803
- directory : str | None = None ,
806
+ directory : str | Path | None = None ,
804
807
paths : list [str ] | None = None ,
805
808
callbacks : CheckoutCallbacks | None = None ,
806
809
) -> None : ...
810
+ def ahead_behind (self , local : _OidArg , upstream : _OidArg ) -> tuple [int , int ]: ...
807
811
def cherrypick (self , id : _OidArg ) -> None : ...
808
812
def compress_references (self ) -> None : ...
809
813
@property
@@ -893,6 +897,12 @@ class Repository:
893
897
commit : _OidArg | None = None ,
894
898
) -> bool | None | str : ...
895
899
def git_object_lookup_prefix (self , oid : _OidArg ) -> Object : ...
900
+ def hashfile (
901
+ self ,
902
+ path : str ,
903
+ object_type : ObjectType = ObjectType .BLOB ,
904
+ as_path : str | None = None ,
905
+ ) -> Oid : ...
896
906
def list_worktrees (self ) -> list [str ]: ...
897
907
def listall_branches (self , flag : BranchType = BranchType .LOCAL ) -> list [str ]: ...
898
908
def listall_mergeheads (self ) -> list [Oid ]: ...
@@ -930,6 +940,13 @@ class Repository:
930
940
flags : MergeFlag = MergeFlag .FIND_RENAMES ,
931
941
file_flags : MergeFileFlag = MergeFileFlag .DEFAULT ,
932
942
) -> Index : ...
943
+ def merge_file_from_index (
944
+ self ,
945
+ ancestor : IndexEntry | None ,
946
+ ours : IndexEntry | None ,
947
+ theirs : IndexEntry | None ,
948
+ use_deprecated : bool = True ,
949
+ ) -> str | MergeFileResult | None : ...
933
950
@staticmethod
934
951
def _merge_options (
935
952
favor : int | MergeFavor , flags : int | MergeFlag , file_flags : int | MergeFileFlag
@@ -971,12 +988,45 @@ class Repository:
971
988
def revparse (self , revspec : str ) -> RevSpec : ...
972
989
def revparse_ext (self , revision : str ) -> tuple [Object , Reference ]: ...
973
990
def revparse_single (self , revision : str ) -> Object : ...
991
+ def revert (self , commit : Commit ) -> None : ...
992
+ def revert_commit (
993
+ self , revert_commit : Commit , our_commit : Commit , mainline : int = 0
994
+ ) -> Index : ...
974
995
def set_ident (self , name : str , email : str ) -> None : ...
975
996
def set_odb (self , odb : Odb ) -> None : ...
976
997
def set_refdb (self , refdb : Refdb ) -> None : ...
977
998
def status (
978
999
self , untracked_files : str = 'all' , ignored : bool = False
979
1000
) -> dict [str , int ]: ...
1001
+ def stash (
1002
+ self ,
1003
+ stasher : Signature ,
1004
+ message : str | None = None ,
1005
+ keep_index : bool = False ,
1006
+ include_untracked : bool = False ,
1007
+ include_ignored : bool = False ,
1008
+ keep_all : bool = False ,
1009
+ paths : list [str ] | None = None ,
1010
+ ) -> None : ...
1011
+ def stash_apply (
1012
+ self ,
1013
+ index : int = 0 ,
1014
+ reinstate_index : bool | None = None ,
1015
+ include_untracked : bool | None = None ,
1016
+ message : str | None = None ,
1017
+ strategy : CheckoutStrategy | None = None ,
1018
+ callbacks : StashApplyCallbacks | None = None ,
1019
+ ) -> None : ...
1020
+ def stash_pop (
1021
+ self ,
1022
+ index : int = 0 ,
1023
+ reinstate_index : bool | None = None ,
1024
+ include_untracked : bool | None = None ,
1025
+ message : str | None = None ,
1026
+ strategy : CheckoutStrategy | None = None ,
1027
+ callbacks : StashApplyCallbacks | None = None ,
1028
+ ) -> None : ...
1029
+ def stash_drop (self , index : int = 0 ) -> None : ...
980
1030
def status_file (self , path : str ) -> int : ...
981
1031
def state (self ) -> RepositoryState : ...
982
1032
def state_cleanup (self ) -> None : ...
0 commit comments