6 my $perforce_id = shift;
7 die "Usage: switch_to_perforce_id.pl 34440" unless $perforce_id;
9 open my $fh, 'git log -z --pretty=raw|' or die $!;
10 local $INPUT_RECORD_SEPARATOR = "\0";
12 my $re = qr/p4raw-id:.+\@$perforce_id/;
14 while ( my $log = <$fh> ) {
15 next unless $log =~ /$re/;
16 my ($commit) = $log =~ /commit ([a-z0-9]+)/;
17 system "git checkout $commit";
18 print "(use git checkout blead to go back)\n";
22 die "No log found for $perforce_id";