Add a new test for overloading.pm
[p5sagit/p5-mst-13.2.git] / Porting / switch_to_perforce_id.pl
1 #!perl
2 use strict;
3 use warnings;
4 use English;
5
6 my $perforce_id = shift;
7 die "Usage: switch_to_perforce_id.pl 34440" unless $perforce_id;
8
9 open my $fh, 'git log -z --pretty=raw|' or die $!;
10 local $INPUT_RECORD_SEPARATOR = "\0";
11
12 my $re = qr/p4raw-id:.+\@$perforce_id/;
13
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";
19     exit;
20 }
21
22 die "No log found for $perforce_id";