[Box Backup-commit] COMMIT r1378 - box/chris/merge/bin/bbackupquery

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Mar 8 22:47:29 GMT 2007


Author: chris
Date: 2007-03-08 22:47:29 +0000 (Thu, 08 Mar 2007)
New Revision: 1378

Modified:
   box/chris/merge/bin/bbackupquery/BackupQueries.cpp
   box/chris/merge/bin/bbackupquery/BackupQueries.h
Log:
Report number of files and directories which could not be compared 
separately from compare failures, and report the appropriate return
code (refs #3, merges [651])


Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-03-08 22:27:39 UTC (rev 1377)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2007-03-08 22:47:29 UTC (rev 1378)
@@ -1054,6 +1054,7 @@
 	  mIgnoreAttributes(false),
 	  mDifferences(0),
 	  mDifferencesExplainedByModTime(0),
+	  mUncheckedFiles(0),
 	  mExcludedDirs(0),
 	  mExcludedFiles(0),
 	  mpExcludeFiles(0),
@@ -1177,13 +1178,29 @@
 		return;
 	}
 	
-	printf("\n[ %d (of %d) differences probably due to file modifications after the last upload ]\nDifferences: %d (%d dirs excluded, %d files excluded)\n",
-		params.mDifferencesExplainedByModTime, params.mDifferences, params.mDifferences, params.mExcludedDirs, params.mExcludedFiles);
+	printf("\n[ %d (of %d) differences probably due to file "
+		"modifications after the last upload ]\n"
+		"Differences: %d (%d dirs excluded, %d files excluded, "
+		"%d files not checked)\n",
+		params.mDifferencesExplainedByModTime, params.mDifferences, 
+		params.mDifferences, params.mExcludedDirs, 
+		params.mExcludedFiles, params.mUncheckedFiles);
 	
 	// Set return code?
 	if(opts['c'])
 	{
-		SetReturnCode((params.mDifferences == 0)?COMPARE_RETURN_SAME:COMPARE_RETURN_DIFFERENT);
+		if (params.mUncheckedFiles != 0)
+		{
+			SetReturnCode(COMPARE_RETURN_ERROR);
+		} 
+		else if (params.mDifferences != 0)
+		{
+			SetReturnCode(COMPARE_RETURN_DIFFERENT);
+		}
+		else
+		{
+			SetReturnCode(COMPARE_RETURN_SAME);
+		}
 	}
 }
 
@@ -1323,6 +1340,7 @@
 		{
 			printf("ERROR: stat on local dir '%s'\n", 
 				localDirDisplay.c_str());
+			rParams.mUncheckedFiles ++;
 		}
 		return;
 	}
@@ -1372,6 +1390,7 @@
 	{
 		printf("ERROR: opendir on local dir '%s'\n", 
 			localDirDisplay.c_str());
+		rParams.mUncheckedFiles ++;
 		return;
 	}
 	try
@@ -1668,10 +1687,12 @@
 						e.GetType(),
 						e.GetSubType(),
 						storePathDisplay.c_str());
+					rParams.mUncheckedFiles ++;
 				}
 				catch(...)
-				{
+				{	
 					printf("ERROR: (unknown) during file fetch and comparison for '%s'\n", storePathDisplay.c_str());
+					rParams.mUncheckedFiles ++;
 				}
 
 				// Remove from set so that we know it's been compared

Modified: box/chris/merge/bin/bbackupquery/BackupQueries.h
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.h	2007-03-08 22:27:39 UTC (rev 1377)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.h	2007-03-08 22:47:29 UTC (rev 1378)
@@ -71,6 +71,7 @@
 		bool mIgnoreAttributes;
 		int mDifferences;
 		int mDifferencesExplainedByModTime;
+		int mUncheckedFiles;
 		int mExcludedDirs;
 		int mExcludedFiles;
 		const ExcludeList *mpExcludeFiles;




More information about the Boxbackup-commit mailing list