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

Method stash_apply

pygit2/repository.py:1313–1359  ·  view source on GitHub ↗

Apply a stashed state in the stash list to the working directory. Parameters: index : int The position within the stash list of the stash to apply. 0 is the most recent stash. reinstate_index : bool Try to reinstate stashed chan

(
        self,
        index: int = 0,
        reinstate_index: bool = False,
        strategy: CheckoutStrategy | None = None,
        callbacks: StashApplyCallbacks | None = None,
    )

Source from the content-addressed store, hash-verified

1311 return Oid(raw=bytes(ffi.buffer(coid)[:]))
1312
1313 def stash_apply(
1314 self,
1315 index: int = 0,
1316 reinstate_index: bool = False,
1317 strategy: CheckoutStrategy | None = None,
1318 callbacks: StashApplyCallbacks | None = None,
1319 ) -> None:
1320 """
1321 Apply a stashed state in the stash list to the working directory.
1322
1323 Parameters:
1324
1325 index : int
1326 The position within the stash list of the stash to apply. 0 is the
1327 most recent stash.
1328
1329 reinstate_index : bool
1330 Try to reinstate stashed changes to the index.
1331
1332 callbacks : StashApplyCallbacks
1333 Optional. Supply a `callbacks` object to get information about
1334 the progress of the stash application as it is being performed.
1335
1336 The callbacks should be an object which inherits from
1337 `pyclass:StashApplyCallbacks`. It should implement the callbacks
1338 as overridden methods.
1339
1340 Note that this class inherits from CheckoutCallbacks, so you can
1341 also get information from the checkout part of the unstashing
1342 process via the callbacks.
1343
1344 The checkout options may be customized using the same arguments taken by
1345 Repository.checkout().
1346
1347 Example::
1348
1349 >>> repo = pygit2.Repository('.')
1350 >>> repo.stash(repo.default_signature, 'WIP: stashing')
1351 >>> repo.stash_apply(strategy=CheckoutStrategy.ALLOW_CONFLICTS)
1352 """
1353 with git_stash_apply_options(
1354 reinstate_index=reinstate_index,
1355 strategy=strategy,
1356 callbacks=callbacks,
1357 ) as payload:
1358 err = C.git_stash_apply(self._repo, index, payload.stash_apply_options)
1359 payload.check_error(err)
1360
1361 def stash_drop(self, index: int = 0) -> None:
1362 """

Callers 3

test_stashFunction · 0.80

Calls 2

check_errorMethod · 0.80
git_stash_apply_optionsFunction · 0.70

Tested by 3

test_stashFunction · 0.64