#!/usr/bin/env perl # Copyright (c) MediaTek USA Inc., 2020 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see # . # # # p4annotate # # This script runs "p4 annotate" for the specified file and formats the result # to match the diffcov(1) 'annotate' callback specification: # use p4annotate; # my $callback = p4annotate->new([--md5] [--log logfile] [--verify]); # $callback->annotate(filename); # # It is implemented so that it can be loaded as a Perl module such that the # callback can be executed without incurring an additional process overhead - # which appears to be large and hightly variable in our compute farm environment. # # It can also be called directly, as # p4annotate [--md5] [--log logfild] [--verify] filename use strict; use FindBin; use lib "$FindBin::RealBin"; use p4annotate qw(new); use annotateutil qw(call_annotate); if (-f $ARGV[-1] || '-' ne index($ARGV[-1], 1)) { call_annotate('p4annotate', $0, @ARGV); } else { p4annotate->new($0, @ARGV); }