3 # given a perforce change number, output the equivalent git commit id
5 die "usage: $0 [git-log-options] num" unless @ARGV;
10 m{^\d+$} && (($change,$_) = ($_,undef));
11 m{^-\d+$} && (($num,$_) = (-$_,undef));
14 my $grep = "--grep=^p4raw-id:.*\@$change\$";
15 @ARGV = grep { defined } @ARGV;
17 if ( -t STDOUT or @ARGV ) {
18 system(qw(git log), $grep, "-$num", "--all", @ARGV);
21 system(qw(git rev-list -1 --all), $grep);