]> gitweb @ CieloNegro.org - sugar.git/blobdiff - tools/find-outdated.pl
Still in early development...
[sugar.git] / tools / find-outdated.pl
diff --git a/tools/find-outdated.pl b/tools/find-outdated.pl
new file mode 100644 (file)
index 0000000..b7e1c8e
--- /dev/null
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+use Smart::Comments;
+use lib 'tools';
+require 'utils.pl';
+use File::stat;
+use File::Spec;
+use File::Compare;
+
+sub main {
+    while (defined(my $rel = <>)) {
+        chomp $rel;
+        my $saved = rel2saved($rel);
+        next if !-e $saved;
+
+        my $abs = File::Spec->rel2abs($rel, $ENV{HOME});
+
+        my $current_st = stat($abs);
+        my $saved_st   = stat($saved);
+
+        if ($current_st->mtime < $saved_st->mtime &&
+              compare($abs, $saved) != 0) {
+            print "U $rel\n";
+        }
+    }
+}
+
+main();