6 # ======================================================================
10 die "usage: $0 [--fast] [--quiet] directory ...\n" .
11 "\t--fast = do not compare file contents\n" .
12 "\t--quiet = do not display identical files\n";
15 # ----------------------------------------------------------------------
26 my $path = shift(@paths);
27 opendir(DIR
, $path) || die "could not open dir $path";
28 while ($_ = readdir(DIR
))
30 next if ($_ eq "." || $_ eq "..");
32 my $new = $path . "/" . $_;
42 push (@localfiles, $new);
51 # ======================================================================
56 # ======================================================================
58 # process command line
59 while (@ARGV && $ARGV[0] =~ /^-/)
63 if ($arg eq "--quiet")
67 elsif ($arg eq "--fast")
76 usage
() if (@ARGV == 0);
82 # get the perforce locations for what was specified
83 open(P4
, "p4 where " . (shift @ARGV) . " |");
86 my ($depot, $client, $local) = split(/ /, $_, 3);
89 # find all the local files
91 $local =~ s
%\
/\
.\
.\
.$%%;
92 foreach (findFiles
($local))
99 # fast mode doesn't compare the contentes
100 open(P4
, "p4 fstat $client#have |") || die "$0: Can't open p4: $!\n";
110 if (defined($file) && defined($action))
112 if ($action ne "delete")
114 if (defined $files{$file})
116 # if we already knew about the file, then mark it as being in both places
117 $files{$file} = "both";
121 # if we didn't know about the file, then it's missing
122 $files{$file} = "missing";
132 if (s
%^\
.\
.\
. clientFile
%%)
137 elsif (s
%^\
.\
.\
. headAction
%%)
147 # diff is more authoritative than the file search, but we'll still keep the extra files
148 open(P4
, "p4 diff -sl $client |") || die "$0: Can't open p4: $!\n";
152 my ($status, $file) = split(/ /, $_, 2);
154 $files{$file} = $status;
159 foreach (sort keys %files)
161 my $status = $files{$_};
162 print "$status $_\n" if (!$quiet || ($status ne "same" && $status ne "both"));