@@ -17,7 +17,7 @@ from typing import (
1717 overload ,
1818)
1919
20- from . import Index
20+ from . import Index , IndexEntry
2121from ._libgit2 .ffi import (
2222 GitCommitC ,
2323 GitMergeOptionsC ,
@@ -28,7 +28,7 @@ from ._libgit2.ffi import (
2828 _Pointer ,
2929)
3030from .blame import Blame
31- from .callbacks import CheckoutCallbacks
31+ from .callbacks import CheckoutCallbacks , StashApplyCallbacks
3232from .config import Config
3333from .enums import (
3434 ApplyLocation ,
@@ -59,6 +59,7 @@ from .enums import (
5959 SortMode ,
6060)
6161from .filter import Filter
62+ from .index import MergeFileResult
6263from .packbuilder import PackBuilder
6364from .remotes import Remote
6465from .repository import BaseRepository
@@ -765,7 +766,9 @@ class Repository:
765766 def _from_c (cls , ptr : 'GitRepositoryC' , owned : bool ) -> 'Repository' : ...
766767 def __iter__ (self ) -> Iterator [Oid ]: ...
767768 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 : ...
769772 def amend_commit (
770773 self ,
771774 commit : Commit | Oid | str ,
@@ -797,13 +800,14 @@ class Repository:
797800 ) -> Blame : ...
798801 def checkout (
799802 self ,
800- refname : Optional [ _OidArg ] ,
803+ refname : _OidArg | None | Reference = None ,
801804 * ,
802805 strategy : CheckoutStrategy | None = None ,
803- directory : str | None = None ,
806+ directory : str | Path | None = None ,
804807 paths : list [str ] | None = None ,
805808 callbacks : CheckoutCallbacks | None = None ,
806809 ) -> None : ...
810+ def ahead_behind (self , local : _OidArg , upstream : _OidArg ) -> tuple [int , int ]: ...
807811 def cherrypick (self , id : _OidArg ) -> None : ...
808812 def compress_references (self ) -> None : ...
809813 @property
@@ -893,6 +897,12 @@ class Repository:
893897 commit : _OidArg | None = None ,
894898 ) -> bool | None | str : ...
895899 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 : ...
896906 def list_worktrees (self ) -> list [str ]: ...
897907 def listall_branches (self , flag : BranchType = BranchType .LOCAL ) -> list [str ]: ...
898908 def listall_mergeheads (self ) -> list [Oid ]: ...
@@ -930,6 +940,13 @@ class Repository:
930940 flags : MergeFlag = MergeFlag .FIND_RENAMES ,
931941 file_flags : MergeFileFlag = MergeFileFlag .DEFAULT ,
932942 ) -> 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 : ...
933950 @staticmethod
934951 def _merge_options (
935952 favor : int | MergeFavor , flags : int | MergeFlag , file_flags : int | MergeFileFlag
@@ -971,12 +988,45 @@ class Repository:
971988 def revparse (self , revspec : str ) -> RevSpec : ...
972989 def revparse_ext (self , revision : str ) -> tuple [Object , Reference ]: ...
973990 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 : ...
974995 def set_ident (self , name : str , email : str ) -> None : ...
975996 def set_odb (self , odb : Odb ) -> None : ...
976997 def set_refdb (self , refdb : Refdb ) -> None : ...
977998 def status (
978999 self , untracked_files : str = 'all' , ignored : bool = False
9791000 ) -> 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 : ...
9801030 def status_file (self , path : str ) -> int : ...
9811031 def state (self ) -> RepositoryState : ...
9821032 def state_cleanup (self ) -> None : ...
0 commit comments