| 95 | |
| 96 | |
| 97 | class BaseRepository(_Repository): |
| 98 | _pointer: '_Pointer[GitRepositoryC]' |
| 99 | _repo: 'GitRepositoryC' |
| 100 | backend: 'RefdbBackend' |
| 101 | default_signature: Signature |
| 102 | head: Reference |
| 103 | head_is_detached: bool |
| 104 | head_is_unborn: bool |
| 105 | is_bare: bool |
| 106 | is_empty: bool |
| 107 | is_shallow: bool |
| 108 | odb: 'Odb' |
| 109 | path: str |
| 110 | refdb: 'Refdb' |
| 111 | workdir: str |
| 112 | references: References |
| 113 | remotes: RemoteCollection |
| 114 | branches: Branches |
| 115 | submodules: SubmoduleCollection |
| 116 | |
| 117 | def __init__(self, *args, **kwargs) -> None: |
| 118 | super().__init__(*args, **kwargs) |
| 119 | self._common_init() |
| 120 | |
| 121 | def _common_init(self) -> None: |
| 122 | self.branches = Branches(self) |
| 123 | self.references = References(self) |
| 124 | self.remotes = RemoteCollection(self) |
| 125 | self.submodules = SubmoduleCollection(self) |
| 126 | self._active_transaction = None |
| 127 | |
| 128 | # Get the pointer as the contents of a buffer and store it for |
| 129 | # later access |
| 130 | repo_cptr = ffi.new('git_repository **') |
| 131 | ffi.buffer(repo_cptr)[:] = self._pointer[:] |
| 132 | self._repo = repo_cptr[0] |
| 133 | |
| 134 | # Backwards compatible ODB access |
| 135 | def read(self, oid: Oid | str) -> tuple[int, bytes]: |
| 136 | """read(oid) -> type, data, size |
| 137 | |
| 138 | Read raw object data from the repository. |
| 139 | """ |
| 140 | return self.odb.read(oid) |
| 141 | |
| 142 | def write(self, type: int, data: bytes | str) -> Oid: |
| 143 | """write(type, data) -> Oid |
| 144 | |
| 145 | Write raw object data into the repository. First arg is the object |
| 146 | type, the second one a buffer with data. Return the Oid of the created |
| 147 | object.""" |
| 148 | return self.odb.write(type, data) |
| 149 | |
| 150 | def pack( |
| 151 | self, |
| 152 | path: str | Path | None = None, |
| 153 | pack_delegate: Callable[[PackBuilder], None] | None = None, |
| 154 | n_threads: int | None = None, |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…