diff options
author | Sam Vilain <sam@vilain.net> | 2008-06-16 23:02:43 +1200 |
---|---|---|
committer | Sam Vilain <sam@vilain.net> | 2008-12-19 14:35:35 +1300 |
commit | 1a95a0fc1d08604e251c0f7ff5da9078aec9eaa7 (patch) | |
tree | e26bdcf97d3194d1020f76d4f39b43f3869fb127 /Porting | |
parent | fb063f91dc7f31f7c1489f10462283ee145673d0 (diff) | |
download | perl-1a95a0fc1d08604e251c0f7ff5da9078aec9eaa7.tar.gz |
Porting: add a little script to find a perforce change
Requested by Nicholas Clark
Diffstat (limited to 'Porting')
-rwxr-xr-x | Porting/git-find-p4-change | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Porting/git-find-p4-change b/Porting/git-find-p4-change new file mode 100755 index 0000000000..b77795355f --- /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); +} |