#=====================================================================# Find all files within directory 'dir'#=====================================================================sub get_recursive_files { my ($dir, $refList) = @_; my @subdirs = (); opendir(BASE, $dir) || die "[opendir] '$dir' ($!)"; my @basefiles = readdir(BASE); closedir(BASE); foreach (@basefiles) { next if /^\.+$/; if (-d "$dir/$_"){ push(@subdirs, "$dir/$_"); } else { push(@$refList, "$dir/$_"); } } get_recursive_files($_, $refList) foreach(@subdirs);}
#=====================================================================# Use iwlistmod to get a list of all modified files and# sub-directories starting from '$dir'# Extract just the 'files' from the above list#=====================================================================sub get_modified_files{ my ($dir, $refList) = @_; chomp(my @modlist = qx($iwhome/bin/iwlistmod "$dir")); foreach (@modlist){ push(@$refList, "$dir/$_") if(/^f\+\s+(.*)$/); }}
#=====================================================================# Use iwcmp to get a list of all modified files and# sub-directories starting from the workarea '$wa'# Extract just the 'files' from the above list and separate# into two categories: "new" and "changed"#=====================================================================sub get_modified_files{ my ($wa, $refNew, $refChanged) = @_; (my $stg = $wa) =~ s|/WORKAREA/[^/]+|/STAGING|; chomp(my @modlist = qx($iwhome/bin/iwcmp "$wa" "$stg")); foreach (@modlist){ if (/^(\S+)\s+(\S+)\s+(\S.*)$/){ if ($1 eq "f+"){ if (($2 eq "f+") # conflict || ($2 eq "f")) # modified in WA { push(@refChanged, "$wa/$3"); } elsif ($2 eq "-"){ push(@refNew, "$wa/$3"); } } } }}