blob: ba1a0b76cf30ef61c89ca926843e15001e6dc2cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/perl
# given a perforce change number, output the equivalent git commit id
die "usage: $0 [git-log-options] num" unless @ARGV;
my $num = 1;
for (@ARGV) {
m{^\d+$} && (($change,$_) = ($_,undef));
m{^-\d+$} && (($num,$_) = (-$_,undef));
}
my $grep = "--grep=^p4raw-id:.*\@$change\$";
@ARGV = grep { defined } @ARGV;
if ( -t STDOUT or @ARGV ) {
system(qw(git log), $grep, "-$num", "--all", @ARGV);
}
else {
system(qw(git rev-list -1 --all), $grep);
}
|