| 1 | package Git::Raw::Stash; | ||
| 2 | 87 | $Git::Raw::Stash::VERSION = '0.90'; | |
| 3 | 87 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 87 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 87 | ▶ | use Git::Raw; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Git::Raw::Stash - Git stash class | ||
| 11 | |||
| 12 | =head1 VERSION | ||
| 13 | |||
| 14 | version 0.90 | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | Helper class to manage stashes. | ||
| 19 | |||
| 20 | B<WARNING>: The API of this module is unstable and may change without warning | ||
| 21 | (any change will be appropriately documented in the changelog). | ||
| 22 | |||
| 23 | =head1 METHODS | ||
| 24 | |||
| 25 | =head2 apply( $repo, $index, [\%stash_apply_opts] ) | ||
| 26 | |||
| 27 | Apply a single stashed state from the stash list. If local changes in the | ||
| 28 | working directory conflict with changes in the stash this function will throw a | ||
| 29 | C<Git::Raw::Error> exception with a C<Git::Raw::Error::EMERGECONFLICT> error | ||
| 30 | code. If you are restoring untracked files or ignored files and there is a | ||
| 31 | conflict when applying the modified files, then those files will remain in the | ||
| 32 | working directory. Valid fields for C<%stash_apply_opts> include: | ||
| 33 | |||
| 34 | =over 4 | ||
| 35 | |||
| 36 | =item * "checkout_opts" | ||
| 37 | |||
| 38 | See C<Git::Raw::Repository-E<gt>checkout()>. | ||
| 39 | |||
| 40 | =item * "flags" | ||
| 41 | |||
| 42 | =over 8 | ||
| 43 | |||
| 44 | =item * "reinstate_index" | ||
| 45 | |||
| 46 | Try to reinstate not only the working tree's changes, but also the index's changes. | ||
| 47 | |||
| 48 | =back | ||
| 49 | |||
| 50 | =item * "callbacks" | ||
| 51 | |||
| 52 | =over 8 | ||
| 53 | |||
| 54 | =item * "apply_progress" | ||
| 55 | |||
| 56 | Progress notification function. The callback receives a single C<$progress> value which | ||
| 57 | may be any constant provided by C<Git::Raw::Stash::Progress>. | ||
| 58 | |||
| 59 | =back | ||
| 60 | |||
| 61 | =back | ||
| 62 | |||
| 63 | =head2 pop( $repo, $index, [\%stash_apply_opts] ) | ||
| 64 | |||
| 65 | Apply a single stashed state from the stash list and remove it from the list if | ||
| 66 | successful. | ||
| 67 | |||
| 68 | =head2 save( $repo, $stasher, $msg [, \@opts] ) | ||
| 69 | |||
| 70 | Save the local modifications to a new stash. Non-default options may be | ||
| 71 | specified by providing the optional C<@opts> argument. If files were stashed, | ||
| 72 | this function will return a L<Git::Raw::Commit> object, otherwise C<undef>. | ||
| 73 | |||
| 74 | Valid fields for the C<@opts> array are: | ||
| 75 | |||
| 76 | =over 4 | ||
| 77 | |||
| 78 | =item * "keep_index" | ||
| 79 | |||
| 80 | All changes already added to the index are left intact in the working directory. | ||
| 81 | The default is to also stash changes in the index. | ||
| 82 | |||
| 83 | =item * "include_untracked" | ||
| 84 | |||
| 85 | All untracked files are also stashed and then cleaned up from the working | ||
| 86 | directory. The default is to leave untracked files in the working directory. | ||
| 87 | |||
| 88 | =item * "include_ignored" | ||
| 89 | |||
| 90 | All ignored files are also stashed and then cleaned up up from the working | ||
| 91 | directory. The default is to leave ignored files in the working directory. | ||
| 92 | |||
| 93 | =back | ||
| 94 | |||
| 95 | =head2 foreach( $repo, $callback ) | ||
| 96 | |||
| 97 | Run C<$callback> for every stash in the repo. The callback receives three | ||
| 98 | arguments: the stash C<$index>, the stash C<$message> and the stash C<$commit>, | ||
| 99 | a L<Git::Raw::Commit> object. A non-zero return value will stop the loop. | ||
| 100 | |||
| 101 | =head2 drop( $repo, $index ) | ||
| 102 | |||
| 103 | Remove a single stash from the stash list. | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | Alessandro Ghedini <alexbio@cpan.org> | ||
| 108 | |||
| 109 | Jacques Germishuys <jacquesg@cpan.org> | ||
| 110 | |||
| 111 | =head1 LICENSE AND COPYRIGHT | ||
| 112 | |||
| 113 | Copyright 2012 Alessandro Ghedini. | ||
| 114 | |||
| 115 | This program is free software; you can redistribute it and/or modify it | ||
| 116 | under the terms of either: the GNU General Public License as published | ||
| 117 | by the Free Software Foundation; or the Artistic License. | ||
| 118 | |||
| 119 | See http://dev.perl.org/licenses/ for more information. | ||
| 120 | |||
| 121 | =cut | ||
| 122 | |||
| 123 | 87 | 1; # End of Git::Raw::Stash | |