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

Method update

pygit2/submodules.py:308–346  ·  view source on GitHub ↗

Update submodules. This will clone a missing submodule and checkout the subrepository to the commit specified in the index of the containing repository. If the submodule repository doesn't contain the target commit (e.g. because fetchRecurseSubmodules isn't set), the

(
        self,
        submodules: Optional[Iterable[str]] = None,
        init: bool = False,
        callbacks: Optional[RemoteCallbacks] = None,
        depth: int = 0,
    )

Source from the content-addressed store, hash-verified

306 submodule.init(overwrite)
307
308 def update(
309 self,
310 submodules: Optional[Iterable[str]] = None,
311 init: bool = False,
312 callbacks: Optional[RemoteCallbacks] = None,
313 depth: int = 0,
314 ) -> None:
315 """
316 Update submodules. This will clone a missing submodule and checkout
317 the subrepository to the commit specified in the index of the
318 containing repository. If the submodule repository doesn't contain the
319 target commit (e.g. because fetchRecurseSubmodules isn't set), then the
320 submodule is fetched using the fetch options supplied in options.
321
322 Parameters:
323
324 submodules
325 Optional list of submodule paths or names. If you omit this parameter
326 or pass None, all submodules will be updated.
327
328 init
329 If the submodule is not initialized, setting this flag to True will
330 initialize the submodule before updating. Otherwise, this will raise
331 an error if attempting to update an uninitialized repository.
332
333 callbacks
334 Optional RemoteCallbacks to clone or fetch the submodule.
335
336 depth
337 Number of commits to fetch.
338 The default is 0 (full commit history).
339 """
340 if submodules is None:
341 submodules = self._repository.listall_submodules()
342
343 instances = [self[s] for s in submodules]
344
345 for submodule in instances:
346 submodule.update(init, callbacks, depth)
347
348 def status(
349 self, name: str, ignore: SubmoduleIgnore = SubmoduleIgnore.UNSPECIFIED

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected