3 # handle command line arguments
4 die "usage: perl p4_integrate_deleted.pl branch-name\n" if (scalar(@ARGV) != 1);
6 # read in the branch view
8 print STDERR
"processing branch $branch\n";
9 open(BRANCH
, "p4 branch -o $branch |");
11 shift @branch while ($branch[0] ne "View:\n");
15 foreach $mapping (@branch)
17 # process all the positive line in the mapping
20 next if ($mapping eq "");
21 ($from, $to) = split(/\s+/, $mapping);
22 next if ($from =~ /^-/);
24 print STDERR
"processing mapping $from -> $to\n";
28 # read in all the deleted source files
29 open(FILES
, "p4 files $from |");
31 print STDERR
"processing files";
41 next if (!/ - delete change /);
49 # read in the set of source files we have. subtract them from the list of deleted files
50 open(HAVE
, "p4 files $from#have |");
52 print STDERR
"processing have";
68 print STDERR
"integrating ", scalar(keys %file), " files\n";
69 foreach (sort keys %file)
71 system("p4 integrate -b $branch -s \"$_\"");