sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 8d45e7d34db891f6a656b0485925917ec0f7abdc
parent c0d67ca3447a10fbad9977da1b76592f150ab1c2
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Mon,  9 Jul 2007 00:37:57 +0000

various sup-sync-back tweaks

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@490 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M bin/sup-sync-back | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/bin/sup-sync-back b/bin/sup-sync-back
@@ -61,16 +61,11 @@ begin
     s
   end
 
-  using_usual_sources =
-    if sources.empty?
-      sources = index.usual_sources.select { |s| s.is_a? Redwood::MBox::Loader } 
-      true
-    else
-      false
-    end
+  if sources.empty?
+    sources = index.usual_sources.select { |s| s.is_a? Redwood::MBox::Loader } 
+  end
 
-  any_modified = false
-  
+  modified_sources = []
   sources.each do |source|
     $stderr.puts "Scanning #{source}..."
 
@@ -118,13 +113,12 @@ begin
       nil # don't actually add anything!
     end
     $stderr.puts "Scanned #{num_scanned}, deleted #{num_deleted}, moved #{num_moved} messages from #{source}."
-    any_modified = true if num_deleted > 0 || num_moved > 0
+    modified_sources << source if num_deleted > 0 || num_moved > 0
     out_fp.close unless opts[:dry_run]
 
-    unless opts[:dry_run] || !any_modified
+    unless opts[:dry_run] || (num_deleted == 0 && num_moved == 0)
       deleted_fp.flush if deleted_fp
       spam_fp.flush if spam_fp
-      out_fp.close
       $stderr.puts "Moving #{out_fp.path} to #{source.file_path}"
       FileUtils.mv out_fp.path, source.file_path
     end
@@ -136,12 +130,8 @@ begin
   end
 
   $stderr.puts "Done."
-  if any_modified
-    if using_usual_sources
-      $stderr.puts "You should now run: sup-sync --changed"
-    else
-      $stderr.puts "You should now run: sup-sync --changed #{sources.join(' ')}"
-    end
+  unless modified_sources.empty?
+    $stderr.puts "You should now run: sup-sync --changed #{modified_sources.join(' ')}"
   end
 rescue Exception => e
   File.open("sup-exception-log.txt", "w") { |f| f.puts e.backtrace }