Allow directories containing ChangeLogs to be passed to resolve-ChangeLogs
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 17:27:26 +0000 (17:27 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 17:27:26 +0000 (17:27 +0000)
         Reviewed by David Kilzer.

         * Scripts/resolve-ChangeLogs:
         (sub findChangeLog): Return a ChangeLog contained within the specified
         directory if one exists.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29770 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/resolve-ChangeLogs

index c5a5688..7706573 100644 (file)
@@ -1,3 +1,14 @@
+2008-01-23  Adam Roben  <aroben@apple.com>
+
+        Allow directories containing ChangeLogs to be passed to
+        resolve-ChangeLogs
+
+        Reviewed by David Kilzer.
+
+        * Scripts/resolve-ChangeLogs:
+        (sub findChangeLog): Return a ChangeLog contained within the specified
+        directory if one exists.
+
 2008-01-23  Steve Falkenburg  <sfalken@apple.com>
 
         <rdar://problem/5698732> Copyright strings should include 2008
index 524301b..fa01243 100755 (executable)
@@ -34,6 +34,7 @@ use FindBin;
 use lib $FindBin::Bin;
 
 use File::Basename;
+use File::Spec;
 use Getopt::Long;
 use VCSUtils;
 
@@ -54,7 +55,16 @@ my $getOptionsResult = GetOptions(
     'w|warnings!'    => \$printWarnings,
 );
 
-my @changeLogFiles = grep { basename($_) eq "ChangeLog" } @ARGV;
+sub findChangeLog {
+    return $_ if basename($_) eq "ChangeLog";
+
+    my $file = File::Spec->catfile($_, "ChangeLog");
+    return $file if -d $_ and -e $file;
+
+    return undef;
+}
+
+my @changeLogFiles = grep { defined $_ } map { findChangeLog($_) } @ARGV;
 
 if (scalar(@changeLogFiles) != scalar(@ARGV)) {
     print STDERR "ERROR: Files listed on command-line that are not ChangeLogs.\n";