| 144 | |
| 145 | |
| 146 | class Remote: |
| 147 | def __init__(self, repo: BaseRepository, ptr: 'GitRemoteC') -> None: |
| 148 | """The constructor is for internal use only.""" |
| 149 | self._repo = repo |
| 150 | self._remote = ptr |
| 151 | self._stored_exception = None |
| 152 | |
| 153 | def __del__(self) -> None: |
| 154 | C.git_remote_free(self._remote) |
| 155 | |
| 156 | @property |
| 157 | def name(self) -> str | None: |
| 158 | """Name of the remote""" |
| 159 | |
| 160 | return maybe_string(C.git_remote_name(self._remote)) |
| 161 | |
| 162 | @property |
| 163 | def url(self) -> str | None: |
| 164 | """Url of the remote""" |
| 165 | |
| 166 | return maybe_string(C.git_remote_url(self._remote)) |
| 167 | |
| 168 | @property |
| 169 | def push_url(self) -> str | None: |
| 170 | """Push url of the remote""" |
| 171 | |
| 172 | return maybe_string(C.git_remote_pushurl(self._remote)) |
| 173 | |
| 174 | def connect( |
| 175 | self, |
| 176 | callbacks: RemoteCallbacks | None = None, |
| 177 | direction: int = C.GIT_DIRECTION_FETCH, |
| 178 | proxy: None | bool | str = None, |
| 179 | ) -> None: |
| 180 | """Connect to the remote. |
| 181 | |
| 182 | Parameters: |
| 183 | |
| 184 | proxy : None or True or str |
| 185 | Proxy configuration. Can be one of: |
| 186 | |
| 187 | * `None` (the default) to disable proxy usage |
| 188 | * `True` to enable automatic proxy detection |
| 189 | * an url to a proxy (`http://proxy.example.org:3128/`) |
| 190 | """ |
| 191 | with git_proxy_options(self, proxy=proxy) as proxy_opts: |
| 192 | with git_remote_callbacks(callbacks) as payload: |
| 193 | err = C.git_remote_connect( |
| 194 | self._remote, |
| 195 | direction, |
| 196 | payload.remote_callbacks, |
| 197 | proxy_opts, |
| 198 | ffi.NULL, |
| 199 | ) |
| 200 | payload.check_error(err) |
| 201 | |
| 202 | def fetch( |
| 203 | self, |
no outgoing calls
no test coverage detected
searching dependent graphs…