| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::BitBucketCli::Branch; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # Created on: 2015-11-12 07:36:10 | 
| 4 |  |  |  |  |  |  | # Create by:  Ivan Wills | 
| 5 |  |  |  |  |  |  | # $Id$ | 
| 6 |  |  |  |  |  |  | # $Revision$, $HeadURL$, $Date$ | 
| 7 |  |  |  |  |  |  | # $Revision$, $Source$, $Date$ | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 6 | use Moo; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 10 | 1 |  |  | 1 |  | 238 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 11 | 1 |  |  | 1 |  | 4 | use Carp; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 44 |  | 
| 12 | 1 |  |  | 1 |  | 5 | use Data::Dumper qw/Dumper/; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 30 |  | 
| 13 | 1 |  |  | 1 |  | 5 | use English qw/ -no_match_vars /; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = 0.008; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | extends qw/App::BitBucketCli::Base/; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | has [qw/ | 
| 20 |  |  |  |  |  |  | displayId | 
| 21 |  |  |  |  |  |  | isDefault | 
| 22 |  |  |  |  |  |  | latestChangeset | 
| 23 |  |  |  |  |  |  | latestCommit | 
| 24 |  |  |  |  |  |  | metadata | 
| 25 |  |  |  |  |  |  | project | 
| 26 |  |  |  |  |  |  | repository | 
| 27 |  |  |  |  |  |  | /] => ( | 
| 28 |  |  |  |  |  |  | is  => 'rw', | 
| 29 |  |  |  |  |  |  | ); | 
| 30 |  |  |  |  |  |  | has team => ( | 
| 31 |  |  |  |  |  |  | is      => 'rw', | 
| 32 |  |  |  |  |  |  | builder => '_team', | 
| 33 |  |  |  |  |  |  | lazy    => 1, | 
| 34 |  |  |  |  |  |  | ); | 
| 35 |  |  |  |  |  |  | has pull_request => ( | 
| 36 |  |  |  |  |  |  | is      => 'rw', | 
| 37 |  |  |  |  |  |  | builder => '_pull_request', | 
| 38 |  |  |  |  |  |  | lazy    => 1, | 
| 39 |  |  |  |  |  |  | ); | 
| 40 |  |  |  |  |  |  | has primary_job => ( | 
| 41 |  |  |  |  |  |  | is      => 'rw', | 
| 42 |  |  |  |  |  |  | builder => '_primary_job', | 
| 43 |  |  |  |  |  |  | lazy    => 1, | 
| 44 |  |  |  |  |  |  | ); | 
| 45 |  |  |  |  |  |  | has pr_job => ( | 
| 46 |  |  |  |  |  |  | is      => 'rw', | 
| 47 |  |  |  |  |  |  | builder => '_pr_job', | 
| 48 |  |  |  |  |  |  | lazy    => 1, | 
| 49 |  |  |  |  |  |  | ); | 
| 50 |  |  |  |  |  |  | has lastChangeTime => ( | 
| 51 |  |  |  |  |  |  | is      => 'rw', | 
| 52 |  |  |  |  |  |  | builder => '_lastChangeTime', | 
| 53 |  |  |  |  |  |  | lazy    => 1, | 
| 54 |  |  |  |  |  |  | ); | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 |  |  | 0 | 1 |  | sub timestamp { $_[0]->metadata->{'com.atlassian.stash.stash-branch-utils:latest-changeset-metadata'}{authorTimestamp}/1000; } | 
| 57 | 0 |  |  | 0 | 1 |  | sub name      { $_[0]->displayId; } | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | sub _pull_request { | 
| 60 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 61 | 0 |  |  |  |  |  | my $prs = $self->{metadata}{'com.atlassian.stash.stash-ref-metadata-plugin:outgoing-pull-request-metadata'}; | 
| 62 | 0 | 0 |  |  |  |  | return 0 if !$prs; | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 | 0 |  |  |  |  | return 0 if exists $prs->{open}; | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 0 |  |  |  |  |  | return App::BitBucketCli::PullRequest->new($prs->{pullRequest}); | 
| 67 |  |  |  |  |  |  | } | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | sub _lastChangeTime { | 
| 70 | 0 |  |  | 0 |  |  | my ($self) = @_; | 
| 71 | 0 |  |  |  |  |  | my $metadata = $self->metadata; | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  |  |  |  |  | my $time = $metadata->{'com.atlassian.stash.stash-branch-utils:latest-changeset-metadata'}{authorTimestamp}; | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 0 | 0 |  |  |  |  | return $time ? int $time / 1000 : 0; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | 1; | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | __END__ | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 NAME | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | App::BitBucketCli::Branch - Stores details about a repository's branch | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =head1 VERSION | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | This documentation refers to App::BitBucketCli::Branch version 0.008 | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | use App::BitBucketCli::Branch; | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | # Brief but working code example(s) here showing the most common usage(s) | 
| 95 |  |  |  |  |  |  | # This section will be as far as many users bother reading, so make it as | 
| 96 |  |  |  |  |  |  | # educational and exemplary as possible. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head2 C<name ()> | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head2 C<timestamp ()> | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =head2 C<TO_JSON ()> | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | Used by L<JSON::XS> for dumping the object | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =head1 ATTRIBUTES | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =head2 displayId | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head2 id | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =head2 isDefault | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =head2 latestChangeset | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =head2 latestCommit | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =head2 metadata | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =head2 project | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =head2 repository | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head2 team | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =head2 pull_request | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head2 primary_job | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =head2 pr_job | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | =head2 lastChangeTime | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =head1 DIAGNOSTICS | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =head1 CONFIGURATION AND ENVIRONMENT | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head1 DEPENDENCIES | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =head1 INCOMPATIBILITIES | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =head1 BUGS AND LIMITATIONS | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | There are no known bugs in this module. | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | Please report problems to Ivan Wills (ivan.wills@gmail.com). | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | Patches are welcome. | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =head1 AUTHOR | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | Ivan Wills - (ivan.wills@gmail.com) | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | Copyright (c) 2015 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). | 
| 162 |  |  |  |  |  |  | All rights reserved. | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | This module is free software; you can redistribute it and/or modify it under | 
| 165 |  |  |  |  |  |  | the same terms as Perl itself. See L<perlartistic>.  This program is | 
| 166 |  |  |  |  |  |  | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | 
| 167 |  |  |  |  |  |  | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 
| 168 |  |  |  |  |  |  | PARTICULAR PURPOSE. | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =cut |