This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make git-find-p4-change only find changes done under perforce.
authorDavid Mitchell <davem@iabyn.com>
Sat, 14 Feb 2009 17:26:11 +0000 (17:26 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sat, 14 Feb 2009 17:26:11 +0000 (17:26 +0000)
That way, later cherry-picking that happens to copy the 'p4raw-id:'
text won't be located by mistake.

Porting/git-find-p4-change

index 55bcbb8..6363ae2 100755 (executable)
@@ -8,6 +8,8 @@ die "usage: $0 [-c|--checkout] [git-log-options] changenum" unless @ARGV;
 my $num = 1;
 my $checkout = 0;
 
+my $before = '--before=2008-12-18'; # only changes made under perforce
+
 for (@ARGV) {
        m{^\d+$} && (($change,$_) = ($_,undef));
        m{^-\d+$} && (($num,$_) = (-$_,undef));
@@ -19,16 +21,16 @@ my $grep = "--grep=^p4raw-id:.*\@$change\$";
 @ARGV = grep { defined } @ARGV;
 
 if ($checkout) {
-    my $commit = qx(git rev-list -1 --all '$grep');
+    my $commit = qx(git rev-list -1 --all $before '$grep');
     chomp $commit;
     die "no commit found" unless $commit;
     system(git => checkout => $commit);
 }
 else {
     if ( -t STDOUT or @ARGV ) {
-       system(qw(git log), $grep, "-$num", "--all", @ARGV);
+       system(qw(git log), $grep, "-$num", "--all", $before, @ARGV);
     }
     else {
-       system(qw(git rev-list -1 --all), $grep);
+       system(qw(git rev-list -1 --all), $before, $grep);
     }
 }