p4tree #2

  • //
  • guest/
  • richard_geiger/
  • utils/
  • p4tree
  • View
  • Commits
  • Open Download .zip Download (584 B)
#!/usr/local/bin/perl

open(FILES, "p4 -s files //...|") || die "open(FILES...)";

my $sts = 0;

while (<FILES>)
  {
    if    (/^error: /) { print; $sts = 1; next; }
    elsif (/^exit: /)  { }
    elsif (/^info: (\/\/.*)#\d+ - \w+ (default ){0,1}change (\d+ ){0,1}\([\w+]+\)$/)
      {
        &do_path($1);
      }
    else
      { die "assert: unparsed info line:\n$_"; }
  }

exit $sts;

my %d;

my $N = 0;

sub do_path
{
  my ($p) = @_;

  $p =~ s/\/[^\/]+$//;
  if ($p eq "/") { return; }

  if (defined($d{$p})) { return; }

  $d{$p} = 1;

  &do_path($p);
  print "$p\n";
}
  
# Change User Description Committed
#2 1105 Richard Geiger Handle degenerate output in depots (like the p4-demo depot!)
with oddly converted db information; i.e., lines of the form:
    //depot/main/jam/hash.h#2 - edit default change (text)
#1 1104 Richard Geiger Add handy "p4tree"
fix typo in "p4mon"