southwark
¶
Extensions to the Dulwich Git library.
Classes:
|
Represents the output of |
The values are lists of filenames, relative to the repository root. |
Data:
Invariant |
Functions:
|
Returns |
|
Check the |
|
Clone a local or remote git repository. |
|
Returns a mapping of commit SHAs to tags. |
|
Return add/delete/modify changes to tree by comparing the index to HEAD. |
|
Returns a list of untracked files. |
|
Returns a context manager which will return |
|
Returns staged, unstaged, and untracked changes relative to the HEAD. |
Contextmanager to aid cloning on Windows during tests. |
-
namedtuple
GitStatus
(staged, unstaged, untracked)[source]¶ Bases:
NamedTuple
Represents the output of
status()
.New in version 0.6.1.
- Fields:
staged (
StagedDict
) – Dict with lists of staged paths.untracked (
List
[PathPlus
]) – List of untracked, un-ignored & non-.git paths.
-
__repr__
()¶ Return a nicely formatted representation string
-
typeddict
StagedDict
[source]¶ Bases:
TypedDict
The values are lists of filenames, relative to the repository root.
New in version 0.6.1.
-
assert_clean
(repo, allow_config=())[source]¶ Returns
True
if the working directory is clean.If not, returns
False
and prints a helpful error message to stderr.
-
clone
(source, target=None, bare=False, checkout=None, errstream=<_io.BufferedWriter name='<stderr>'>, origin='origin', depth=None, **kwargs)[source]¶ Clone a local or remote git repository.
- Parameters:
source (
Union
[str
,bytes
]) – Path or URL for source repository.target (
Union
[str
,Path
,PathLike
,bytes
,None
]) – Path to target repository. DefaultNone
.bare (
bool
) – Whether to create a bare repository. DefaultFalse
.checkout (
Optional
[bool
]) – Whether to check-out HEAD after cloning. DefaultNone
.errstream (
IO
) – Optional stream to write progress to. Default<_io.BufferedWriter name='<stderr>'>
.origin (
Union
[str
,bytes
]) – Name of remote from the repository used to clone. Default'origin'
.
- Return type:
- Returns:
The cloned repository.
New in version 0.6.1.
Changed in version 0.7.2:target
now acceptsdomdf_python_tools.typing.PathLike
objects.origin
now acceptsstr
objects.
-
get_tree_changes
(repo)[source]¶ Return add/delete/modify changes to tree by comparing the index to HEAD.
- Parameters:
repo (
Union
[str
,Path
,PathLike
,Repo
]) – repo path or object.- Return type:
- Returns:
Dictionary containing changes for each type of change.
New in version 0.6.1.
-
open_repo_closing
(path_or_repo)[source]¶ Returns a context manager which will return
dulwich.repo.Repo
objects unchanged, but will create a newdulwich.repo.Repo
when a filesystem path is given.New in version 0.7.0.
- Parameters:
path_or_repo – Either a
dulwich.repo.Repo
object or the path of a repository.- Return type:
- Overloads:
open_repo_closing
(path_or_repo:~_DR
) ->ContextManager
[~_DR
]open_repo_closing
(path_or_repo:Union
[str
,PathLike
] ) ->ContextManager
[Repo
]