Skip to content

Commit

Permalink
Simplified calling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwills-optus committed Aug 25, 2016
1 parent f2c05d0 commit 4c60aa7
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions bin/vcsvimdiff
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,21 @@ sub main {

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;

if ($option{replay}) {
replay($file, $vcs, $rev_old, $rev_new, $temp_dir);
}
elsif ( $option{merge}) {
merge($file, $vcs, $rev_old, $rev_new, $temp_dir);
}
elsif ($rev_new) {
rev_new($file, $vcs, $rev_old, $rev_new, $temp_dir);
}
elsif ($rev_old) {
rev_old($file, $vcs, $rev_old, $rev_new, $temp_dir);
}
else {
rev_default($file, $vcs, $rev_old, $rev_new, $temp_dir);
}
my $command
= $option{replay} ? 'replay'
: $option{merge} ? 'merge'
: $rev_new ? 'rev_new'
: $rev_old ? 'rev_old'
: 'rev_default';

main->$command($file, $vcs, $rev_old, $rev_new, $temp_dir);
}

return;
}

sub replay {
my ($file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;
my (undef, $file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;
Expand Down Expand Up @@ -202,7 +194,7 @@ sub replay {
}

sub merge {
my ($file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;
my (undef, $file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;
Expand Down Expand Up @@ -231,7 +223,7 @@ sub merge {
}

sub rev_new {
my ($file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;
my (undef, $file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;
Expand All @@ -249,7 +241,7 @@ sub rev_new {
}

sub rev_old {
my ($file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;
my (undef, $file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;
Expand All @@ -266,7 +258,7 @@ sub rev_old {
}

sub rev_default {
my ($file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;
my (undef, $file, $vcs, $rev_old, $rev_new, $temp_dir) = @_;

# create the temporary file object name
my $tmp = "$temp_dir/$$.$name." . path($file)->basename;
Expand Down

0 comments on commit 4c60aa7

Please sign in to comment.