In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/31e2bab67ef806066958b418a44d05d77a853d83?hp=44815675c4d350844753c67afaecfc558d824452>

- Log -----------------------------------------------------------------
commit 31e2bab67ef806066958b418a44d05d77a853d83
Author: Rafael Garcia-Suarez <[email protected]>
Date:   Sat Dec 20 23:28:17 2008 +0100

    Replace Jarkko's manicheck utility with my own
    
    My manicheck is more crude, but I find its output more readable,
    and more importantly it handles git-related files and directories.
    Options can be re-added later.
    
    (cherry picked from commit 4d1e77f96f82d16036b88dca7b4fa2cd3a59bf21)

M       Porting/manicheck

commit 85754ae9a847765bfdd2ad2bf07a6e5f713dd97f
Author: Rafael Garcia-Suarez <[email protected]>
Date:   Sat Dec 20 23:25:36 2008 +0100

    Add missing files to the MANIFEST
    
    TODO: those two new scripts can be merged together.
    
    (cherry picked from commit a21dc152d0bd90f991fd36bbf1eeacf5983636c6)

M       MANIFEST

commit ee64842bc790a93f4f81821591246c72ec1bb8d9
Author: Leon Brocard <[email protected]>
Date:   Sat Dec 20 08:42:06 2008 +0000

    Add a program to switch to a Perforce id
    
    (cherry picked from commit 734abad9c35353b7df4e009f63d8b7c5c845141c)

A       Porting/switch_to_perforce_id.pl
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                         |    2 +
 Porting/manicheck                |   97 +++++++-------------------------------
 Porting/switch_to_perforce_id.pl |   22 +++++++++
 3 files changed, 41 insertions(+), 80 deletions(-)
 create mode 100755 Porting/switch_to_perforce_id.pl

diff --git a/MANIFEST b/MANIFEST
index adb035e..e302415 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3471,6 +3471,7 @@ Porting/findvars  Find occurrences of words
 Porting/fixCORE                Find and fix modules that generate warnings
 Porting/fixvars                Find undeclared variables with C compiler and 
fix em
 Porting/genlog         Generate formatted changelogs by querying p4d
+Porting/git-find-p4-change     Find the change for a p4 change number
 Porting/Glossary       Glossary of config.sh variables
 Porting/Maintainers    Program to pretty print info in Maintainers.pl
 Porting/Maintainers.pl Information about maintainers
@@ -3487,6 +3488,7 @@ Porting/README.y2038      Perl notes for the 2038 fix
 Porting/regcharclass.pl        Generate regcharclass.h from inline data
 Porting/repository.pod How to use the Perl repository
 Porting/sort_perldiag.pl       Keep our diagnostics orderly
+Porting/switch_to_perforce_id.pl       Checkout a given p4 change number
 Porting/testall.atom           Cumulative profile with Third Degree
 Porting/thirdclean             Cleanup Third Degree reports
 Porting/timecheck.c            Test program for the 2038 fix
diff --git a/Porting/manicheck b/Porting/manicheck
index 251c7ee..0439292 100644
--- a/Porting/manicheck
+++ b/Porting/manicheck
@@ -1,86 +1,23 @@
-#!/usr/bin/perl -ws
-
-#
-# manicheck - check files against the MANIFEST
-#
-# Without options prints out (possibly) two lines:
-#
-# extra: a b c
-# missing: d
-#
-# With option -x prints out only the missing files (and without the "extra: ")
-# With option -m prints out only the extra files (and without the "missing: ")
-#
-
-BEGIN {
-  $SIG{__WARN__} = sub {
-    help() if $_[0] =~ /"main::\w" used only once: possible typo at /;
-  };
-}
+#!/usr/bin/perl
 
 use strict;
-
-sub help {
-  die <<EOF;
-$0: Usage: $0 [-x|-m|-l|-h]
--x show only the extra files
--m show only the missing files
--l show the files one per line instead of one line
--h show only this help
-EOF
-}
-
-use vars qw($x $m $l $h);
-
-help() if $h;
-
-open(MANIFEST, "MANIFEST") or die "MANIFEST: $!";
-
-my %mani;
-my %mand = qw(. 1);
-use File::Basename qw(dirname);
-
-while (<MANIFEST>) {
-  if (/^(\S+)\t+(.+)$/) {
-    $mani{$1}++;
-    my $d = dirname($1);
-    while($d ne '.') {
-       $mand{$d}++;
-       $d = dirname($d);
-    }
-  } else {
-    warn "MANIFEST:$.:$_";
-  }
-}
-
-close(MANIFEST);
-
-my %find;
+use warnings;
 use File::Find;
-find(sub {
-       my $n = $File::Find::name;
-       $n =~ s:^\./::;
-       $find{$n}++;
-     }, '.' );
-
-my @xtra;
-my @miss;
-
-for (sort keys %find) {
-  push @xtra, $_ unless $mani{$_} || $mand{$_};
-}
 
-for (sort keys %mani) {
-  push @miss, $_ unless $find{$_};
+open my $fh, 'MANIFEST' or die "Can't read MANIFEST: $!\n";
+my @files = map { (split)[0] } <$fh>;
+close $fh;
+for (@files) {
+    print "$_ from MANIFEST doesn't exist\n" if ! -f;
 }
-
-$" = "\n" if $l;
-
-unshift @xtra, "extra:"   if @xtra && !$x;
-unshift @miss, "missing:" if @miss && !$m;
-
-print "@xtra\n", if @xtra && !$m;
-print "@miss\n"  if @miss && !$x;
-
-exit 0;
+my %files = map { $_ => 1 } @files;
+find {
+    wanted => sub {
+        my $x = $File::Find::name; $x =~ s/^..//;
+        return if -d;
+       return if $_ eq '.gitignore';
+       return if $x =~ /^\.git\b/;
+        print "$File::Find::name not in MANIFEST\n" if !$files{$x};
+    },
+}, ".";
 
diff --git a/Porting/switch_to_perforce_id.pl b/Porting/switch_to_perforce_id.pl
new file mode 100755
index 0000000..cf21a13
--- /dev/null
+++ b/Porting/switch_to_perforce_id.pl
@@ -0,0 +1,22 @@
+#!perl
+use strict;
+use warnings;
+use English;
+
+my $perforce_id = shift;
+die "Usage: switch_to_perforce_id.pl 34440" unless $perforce_id;
+
+open my $fh, 'git log -z --pretty=raw|' || die $!;
+local $INPUT_RECORD_SEPARATOR = "\0";
+
+my $re = qr/p4raw-id:....@$perforce_id/;
+
+while ( my $log = <$fh> ) {
+    next unless $log =~ /$re/;
+    my ($commit) = $log =~ /commit ([a-z0-9]+)/;
+    system "git checkout $commit";
+    print "(use git checkout blead to go back)\n";
+    exit;
+}
+
+die "No log found for $perforce_id";

--
Perl5 Master Repository

Reply via email to