| 1 | package Git::Raw::Tag; | ||
| 2 | 1 | $Git::Raw::Tag::VERSION = '0.90'; | |
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use Git::Raw; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Git::Raw::Tag - Git tag class | ||
| 11 | |||
| 12 | =head1 VERSION | ||
| 13 | |||
| 14 | version 0.90 | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | use Git::Raw; | ||
| 19 | |||
| 20 | # open the Git repository at $path | ||
| 21 | my $repo = Git::Raw::Repository -> open($path); | ||
| 22 | |||
| 23 | # retrieve user's name and email from the Git configuration | ||
| 24 | my $config = $repo -> config; | ||
| 25 | my $name = $config -> str('user.name'); | ||
| 26 | my $email = $config -> str('user.email'); | ||
| 27 | |||
| 28 | # create a new Git signature | ||
| 29 | my $me = Git::Raw::Signature -> now($name, $email); | ||
| 30 | |||
| 31 | # create a new tag | ||
| 32 | my $tag = $repo -> tag( | ||
| 33 | 'v0.1', 'Initial version', $me, $repo -> head -> target | ||
| 34 | ); | ||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | A L<Git::Raw::Tag> represents an annotated Git tag. | ||
| 39 | |||
| 40 | B<WARNING>: The API of this module is unstable and may change without warning | ||
| 41 | (any change will be appropriately documented in the changelog). | ||
| 42 | |||
| 43 | =head1 METHODS | ||
| 44 | |||
| 45 | =head2 create( $repo, $name, $msg, $tagger, $target ) | ||
| 46 | |||
| 47 | Create a new annotated tag given a name, a message, a | ||
| 48 | L<Git::Raw::Signature> representing the tagger and a target object. | ||
| 49 | |||
| 50 | =head2 lookup( $repo, $id ) | ||
| 51 | |||
| 52 | Retrieve the tag corresponding to C<$id>. This function is pretty much the same | ||
| 53 | as C<$repo-E<gt>lookup($id)> except that it only returns tags. If the tag | ||
| 54 | doesn't exist, this function will return C<undef>. | ||
| 55 | |||
| 56 | =head2 owner( ) | ||
| 57 | |||
| 58 | Retrieve the L<Git::Raw::Repository> owning the tag. | ||
| 59 | |||
| 60 | =head2 foreach( $repo, $callback, [$type] ) | ||
| 61 | |||
| 62 | Run C<$callback> for every tag in the repo. The callback receives a tag object, | ||
| 63 | which will either a be a L<Git::Raw::Tag> object for annotated tags, or a | ||
| 64 | L<Git::Raw::Reference> for lightweight tags. C<$type> may be C<"all">, | ||
| 65 | C<"annotated"> or C<"lightweight">. If C<$type> is not specified or is C<undef>, | ||
| 66 | all tags will be returned. A non-zero return value stops the loop. | ||
| 67 | |||
| 68 | =head2 delete( ) | ||
| 69 | |||
| 70 | Delete the tag. The L<Git::Raw::Tag> object must not be accessed afterwards. | ||
| 71 | |||
| 72 | =head2 id( ) | ||
| 73 | |||
| 74 | Retrieve the id of the tag, as a string. | ||
| 75 | |||
| 76 | =head2 name( ) | ||
| 77 | |||
| 78 | Retrieve the name of the tag. | ||
| 79 | |||
| 80 | =head2 message( ) | ||
| 81 | |||
| 82 | Retrieve the message of the tag. | ||
| 83 | |||
| 84 | =head2 tagger( ) | ||
| 85 | |||
| 86 | Retrieve the L<Git::Raw::Signature> representing the tag's tagger. If there | ||
| 87 | is no tagger, C<undef> will be returned. | ||
| 88 | |||
| 89 | =head2 target( ) | ||
| 90 | |||
| 91 | Retrieve the target object of the tag. | ||
| 92 | |||
| 93 | =head1 AUTHOR | ||
| 94 | |||
| 95 | Alessandro Ghedini <alexbio@cpan.org> | ||
| 96 | |||
| 97 | Jacques Germishuys <jacquesg@cpan.org> | ||
| 98 | |||
| 99 | =head1 LICENSE AND COPYRIGHT | ||
| 100 | |||
| 101 | Copyright 2012 Alessandro Ghedini. | ||
| 102 | |||
| 103 | This program is free software; you can redistribute it and/or modify it | ||
| 104 | under the terms of either: the GNU General Public License as published | ||
| 105 | by the Free Software Foundation; or the Artistic License. | ||
| 106 | |||
| 107 | See http://dev.perl.org/licenses/ for more information. | ||
| 108 | |||
| 109 | =cut | ||
| 110 | |||
| 111 | 1 | 1; # End of Git::Raw::Tag | |