From: Sam Vilain Date: Mon, 16 Jun 2008 11:02:43 +0000 (+1200) Subject: Porting: add a little script to find a perforce change X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a95a0fc1d08604e251c0f7ff5da9078aec9eaa7;p=p5sagit%2Fp5-mst-13.2.git Porting: add a little script to find a perforce change Requested by Nicholas Clark --- diff --git a/Porting/git-find-p4-change b/Porting/git-find-p4-change new file mode 100755 index 0000000..b777953 --- /dev/null +++ b/Porting/git-find-p4-change @@ -0,0 +1,20 @@ +#!/usr/bin/perl + +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); +}