[gnumeric-web] sync: be smarter are more verbose about what to upload.



commit 59ee69896c31cb653f20fd0cec7de443907dcc1a
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 22 20:16:45 2016 -0400

    sync: be smarter are more verbose about what to upload.

 ftp-sync |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/ftp-sync b/ftp-sync
index 8dcaeb7..53a5763 100755
--- a/ftp-sync
+++ b/ftp-sync
@@ -70,27 +70,32 @@ foreach my $l (@lines) {
        my $filename = $f[8];
        my ($mtime,$mtime_res) = &decode_time ($f[5], $f[6], $f[7]);
 
-       $files{"$dir/$filename"} = [$size,$mtime,$mtime_res];
+       my $full = "$dir/$filename";
+       $full =~ s{^./+}{};
+       $files{$full} = [$size,$mtime,$mtime_res];
+       print STDERR "Have $full\n";
     }
 }
 
 foreach my $p (@manifest) {
     my ($fn,$size,$mtime) = @$p;
 
-    if (exists $files{"./$fn"}) {
+    my $reason = 'new';
+    if (exists $files{$fn}) {
        # print "We already have $fn\n";
-       my ($usize,$umtime,$umtime_res) = @{$files{"./$fn"}};
+       my ($usize,$umtime,$umtime_res) = @{$files{$fn}};
 
        my $same = 1;
        $same &= ($usize == $size);
        $same &= ($mtime < $umtime);
        next if $same;
 
-       # print "$size $usize\n";
-       # print "$mtime $umtime $umtime_res\n";
+       $reason = 'change:';
+       $reason .= " size" if $size != $usize;
+       $reason .= " time" if $mtime != $umtime;
     }
 
-    print "We need to upload $fn\n";
+    print "We need to upload $fn [$reason]\n";
 
     my $thismode = &guess_mode ($fn);
     if ($thismode ne $mode) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]