App-Git-Workflow-Command-BranchConflicts

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        Added missing dependencies (Ivan Wills)
        Fixed version numbers (Ivan Wills)
        Fixed ignores (Ivan Wills)
        Fixing tests (Ivan Wills)
        Fixed skipping build files (Ivan Wills)
        Removed incorrect to manifest files (Ivan Wills)
        Updated mock data to match code changes (Ivan Wills)
        Fixed up documentation (Ivan Wills)
        Added ability to ignore certain file changes (Ivan Wills)
        Added further cleaning up of branch before moving on (Ivan Wills)
        Added capturing stderr from git to keep output clean (Ivan Wills)
        Removed unneeded tag (Ivan Wills)
        Added meta.json file (Ivan Wills)
        Updated licence (Ivan Wills)
        Fixed spelling (Ivan Wills)
        Fixed module description (Ivan Wills)
        Fixed test data (Ivan Wills)
        Added ability to limit checked branches not merged to another branch or not modified after a certain date (Ivan Wills)
        Added more content to skip file (Ivan Wills)
        Fixed boilerplate test (Ivan Wills)
        Fixed tests (Ivan Wills)

lib/App/Git/Workflow/Command/BranchConflicts.pm  view on Meta::CPAN

# $Revision$, $HeadURL$, $Date$
# $Revision$, $Source$, $Date$

use strict;
use warnings;
use Pod::Usage ();
use Data::Dumper qw/Dumper/;
use English qw/ -no_match_vars /;
use App::Git::Workflow;
use App::Git::Workflow::Command qw/get_options/;
use Capture::Tiny qw/capture_stderr/;

our $VERSION  = 0.6;
our $workflow = App::Git::Workflow->new;
our ($name)   = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs;
our %option;

sub run {
    my ($self) = @_;

    get_options(

lib/App/Git/Workflow/Command/BranchConflicts.pm  view on Meta::CPAN

        for my $branch (@branches) {
            next if $option{since} && !$workflow->git->log(qw/-n1 --since/, $option{since}, $branch);
            if ( $self->merge_branch_conflicts($branch) ) {
                push @{ $conflicts{$first_branch} }, $branch;
            }
        }

        $workflow->git->reset('HEAD');
        $workflow->git->clean('-xfd');
        $workflow->git->checkout('.');
        capture_stderr {
            $workflow->git->checkout('-');
        };
    }

    if (%conflicts) {
        print "Conflicting branches:\n";
        for my $branch (sort keys %conflicts) {
            print "  $branch\n", map {"    $_\n"} @{ $conflicts{$branch} };
        }
    }

lib/App/Git/Workflow/Command/BranchConflicts.pm  view on Meta::CPAN

    $self->cleanup();

    return;
}

my @checkouts;
sub checkout_branch {
    my ($self, $branch) = @_;

    my $local = 'branch-conflicts-' . sprintf '%03i', scalar @checkouts;
    capture_stderr {
        $workflow->git->checkout('-b', $local, '--no-track', $branch);
    };

    push @checkouts, $local;

    return $local;
}

sub merge_branch_conflicts {
    my ($self, $branch) = @_;

    capture_stderr {
        eval { $workflow->git->merge('--no-commit', $branch) };
    };
    my $status = $workflow->git->status;
    eval { $workflow->git->merge('--abort'); };

    if ($option{ignore}) {
        $status =~ s/both (?:added|modified): \s+ $option{ignore}//;
    }

    return $status =~ /both (?:added|modified)/;



( run in 0.258 second using v1.01-cache-2.11-cpan-26ccb49234f )