MCPcopy Create free account
hub / github.com/libgit2/pygit2 / __init__

Method __init__

pygit2/branches.py:43–60  ·  view source on GitHub ↗
(
        self,
        repository: BaseRepository,
        flag: BranchType = BranchType.ALL,
        commit: Commit | Oid | str | None = None,
    )

Source from the content-addressed store, hash-verified

41 remote: 'Branches'
42
43 def __init__(
44 self,
45 repository: BaseRepository,
46 flag: BranchType = BranchType.ALL,
47 commit: Commit | Oid | str | None = None,
48 ) -> None:
49 self._repository = repository
50 self._flag = flag
51 if commit is not None:
52 if isinstance(commit, Commit):
53 commit = commit.id
54 elif not isinstance(commit, Oid):
55 commit = self._repository.expand_id(commit)
56 self._commit = commit
57
58 if flag == BranchType.ALL:
59 self.local = Branches(repository, flag=BranchType.LOCAL, commit=commit)
60 self.remote = Branches(repository, flag=BranchType.REMOTE, commit=commit)
61
62 def __getitem__(self, name: str) -> Branch:
63 branch = None

Callers

nothing calls this directly

Calls 1

BranchesClass · 0.85

Tested by

no test coverage detected