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

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Oct 15 20:19:56 BST 2006


Author: chris
Date: 2006-10-15 20:19:56 +0100 (Sun, 15 Oct 2006)
New Revision: 1052

Modified:
   box/chris/merge/bin/bbackupquery/BackupQueries.cpp
   box/chris/merge/bin/bbackupquery/BackupQueries.h
   box/chris/merge/bin/bbackupquery/documentation.txt
Log:
Add an option to ignore attribute differences on compare. (refs #3)


Modified: box/chris/merge/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2006-10-15 19:17:58 UTC (rev 1051)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.cpp	2006-10-15 19:19:56 UTC (rev 1052)
@@ -206,7 +206,7 @@
 		{ "sh",   "" },
 		{ "getobject", "" },
 		{ "get",  "i" },
-		{ "compare", "alcqE" },
+		{ "compare", "alcqAE" },
 		{ "restore", "dri" },
 		{ "help", "" },
 		{ "usage", "" },
@@ -1050,6 +1050,7 @@
 BackupQueries::CompareParams::CompareParams()
 	: mQuickCompare(false),
 	  mIgnoreExcludes(false),
+	  mIgnoreAttributes(false),
 	  mDifferences(0),
 	  mDifferencesExplainedByModTime(0),
 	  mExcludedDirs(0),
@@ -1112,6 +1113,7 @@
 	BackupQueries::CompareParams params;
 	params.mQuickCompare = opts['q'];
 	params.mIgnoreExcludes = opts['E'];
+	params.mIgnoreAttributes = opts['A'];
 	
 	// Try and work out the time before which all files should be on the server
 	{
@@ -1559,8 +1561,17 @@
 						box_time_t fileModTime = 0;
 						localAttr.ReadAttributes(localPath.c_str(), false /* don't zero mod times */, &fileModTime);					
 						modifiedAfterLastSync = (fileModTime > rParams.mLatestFileUploadTime);
-						if(!localAttr.Compare(fileOnServerStream->GetAttributes(),
-								true /* ignore attr mod time */,
+						bool ignoreAttrModTime = true;
+
+						#ifdef WIN32
+						// attr mod time is really
+						// creation time, so check it
+						ignoreAttrModTime = false;
+						#endif
+
+						if(!rParams.mIgnoreAttributes &&
+						   !localAttr.Compare(fileOnServerStream->GetAttributes(),
+								ignoreAttrModTime,
 								fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */))
 						{
 							printf("Local file '%s' "

Modified: box/chris/merge/bin/bbackupquery/BackupQueries.h
===================================================================
--- box/chris/merge/bin/bbackupquery/BackupQueries.h	2006-10-15 19:17:58 UTC (rev 1051)
+++ box/chris/merge/bin/bbackupquery/BackupQueries.h	2006-10-15 19:19:56 UTC (rev 1052)
@@ -68,6 +68,7 @@
 		void DeleteExcludeLists();
 		bool mQuickCompare;
 		bool mIgnoreExcludes;
+		bool mIgnoreAttributes;
 		int mDifferences;
 		int mDifferencesExplainedByModTime;
 		int mExcludedDirs;

Modified: box/chris/merge/bin/bbackupquery/documentation.txt
===================================================================
--- box/chris/merge/bin/bbackupquery/documentation.txt	2006-10-15 19:17:58 UTC (rev 1051)
+++ box/chris/merge/bin/bbackupquery/documentation.txt	2006-10-15 19:19:56 UTC (rev 1052)
@@ -104,6 +104,7 @@
 	-c -- set return code
 	-q -- quick compare. Only checks file contents against checksums,
 			doesn't do a full download
+	-A -- ignore attribute differences
 	-E -- ignore exclusion settings
 	
 	Comparing with the root directory is an error, use -a option instead.




More information about the Boxbackup-commit mailing list