Add a new Porting/podtidy to reformat pod using Pod::Tidy
[p5sagit/p5-mst-13.2.git] / Porting / switch_to_perforce_id.pl
CommitLineData
734abad9 1#!perl
2use strict;
3use warnings;
4use English;
5
6my $perforce_id = shift;
7die "Usage: switch_to_perforce_id.pl 34440" unless $perforce_id;
8
c8254d1d 9open my $fh, 'git log -z --pretty=raw|' or die $!;
734abad9 10local $INPUT_RECORD_SEPARATOR = "\0";
11
12my $re = qr/p4raw-id:.+\@$perforce_id/;
13
14while ( 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
22die "No log found for $perforce_id";