| 1 | package Git::Raw::Branch; | ||
| 2 | 1 | $Git::Raw::Branch::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::Branch - Git branch 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 | # create a new branch named 'some_branch' | ||
| 24 | $repo -> branch('some_branch', $repo -> head -> target); | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | Helper class for branch manipulation. Note that a Git branch is nothing more | ||
| 29 | than a L<Git::Raw::Reference>, so this class inherits all methods from it. | ||
| 30 | |||
| 31 | B<WARNING>: The API of this module is unstable and may change without warning | ||
| 32 | (any change will be appropriately documented in the changelog). | ||
| 33 | |||
| 34 | =head1 METHODS | ||
| 35 | |||
| 36 | =head2 create( $repo, $name, $target ) | ||
| 37 | |||
| 38 | Create a new branch given a name and a target object (either a | ||
| 39 | L<Git::Raw::Commit> or a L<Git::Raw::Tag>). | ||
| 40 | |||
| 41 | =head2 lookup( $repo, $name, $is_local ) | ||
| 42 | |||
| 43 | Retrieve the branch corresponding to the given branch name. | ||
| 44 | |||
| 45 | =head2 move( $name, $force ) | ||
| 46 | |||
| 47 | Rename the branch to C<$name>. Note that in order to get the updated branch | ||
| 48 | object, an additional C<Git::Raw::Branch-E<gt>lookup()> is needed. | ||
| 49 | |||
| 50 | =head2 upstream( [$upstream] ) | ||
| 51 | |||
| 52 | Retrieve or set the reference supporting the remote tracking branch, given the | ||
| 53 | local branch. If there is no corresponding supporting reference, this function | ||
| 54 | will return C<undef>. C<$upstream> may either be a L<Git::Raw::Reference>, a | ||
| 55 | string containing the upstream reference name or C<undef>. If C<$upstream> is | ||
| 56 | set to C<undef>, the remote tracking branch association is removed. | ||
| 57 | |||
| 58 | =head2 upstream_name( ) | ||
| 59 | |||
| 60 | Return the name of the reference supporting the remote tracking branch, given | ||
| 61 | the the local branch. If there is no associated remote tracking branch, this | ||
| 62 | function will return C<undef>. | ||
| 63 | |||
| 64 | =head2 remote_name( ) | ||
| 65 | |||
| 66 | Return the name of remote that the remote tracking branch belongs to, given | ||
| 67 | the local branch. If there is no associated remote tracking branch, this | ||
| 68 | function will return C<undef>. | ||
| 69 | |||
| 70 | =head2 is_head( ) | ||
| 71 | |||
| 72 | Check if the current local branch is pointed at by HEAD. | ||
| 73 | |||
| 74 | =head1 AUTHOR | ||
| 75 | |||
| 76 | Alessandro Ghedini <alexbio@cpan.org> | ||
| 77 | |||
| 78 | Jacques Germishuys <jacquesg@cpan.org> | ||
| 79 | |||
| 80 | =head1 LICENSE AND COPYRIGHT | ||
| 81 | |||
| 82 | Copyright 2012 Alessandro Ghedini. | ||
| 83 | |||
| 84 | This program is free software; you can redistribute it and/or modify it | ||
| 85 | under the terms of either: the GNU General Public License as published | ||
| 86 | by the Free Software Foundation; or the Artistic License. | ||
| 87 | |||
| 88 | See http://dev.perl.org/licenses/ for more information. | ||
| 89 | |||
| 90 | =cut | ||
| 91 | |||
| 92 | 1 | 1; # End of Git::Raw::Branch | |