diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 12 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch2/Client.cpp | 4 | ||||
-rw-r--r-- | cpp/src/IcePatch2Lib/ClientUtil.cpp | 115 |
4 files changed, 121 insertions, 12 deletions
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 014228c8392..5236802f041 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jan 18 16:16:35 2013 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jan 24 22:31:36 2013 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -578,11 +578,11 @@ const IceInternal::Property IcePatch2PropsData[] = IceInternal::Property("IcePatch2.ThreadPool.Serialize", false, 0), IceInternal::Property("IcePatch2.ThreadPool.ThreadIdleTime", false, 0), IceInternal::Property("IcePatch2.ThreadPool.ThreadPriority", false, 0), - IceInternal::Property("IcePatch2.ChunkSize", false, 0), + IceInternal::Property("IcePatch2.ChunkSize", true, "IcePatch2Client.ChunkSize"), IceInternal::Property("IcePatch2.Directory", false, 0), IceInternal::Property("IcePatch2.InstanceName", false, 0), - IceInternal::Property("IcePatch2.Remove", false, 0), - IceInternal::Property("IcePatch2.Thorough", false, 0), + IceInternal::Property("IcePatch2.Remove", true, "IcePatch2Client.Remove"), + IceInternal::Property("IcePatch2.Thorough", true, "IcePatch2Client.Thorough"), }; const IceInternal::PropertyArray @@ -591,7 +591,11 @@ const IceInternal::PropertyArray const IceInternal::Property IcePatch2ClientPropsData[] = { + IceInternal::Property("IcePatch2Client.ChunkSize", false, 0), + IceInternal::Property("IcePatch2Client.Directory", false, 0), IceInternal::Property("IcePatch2Client.Proxy", false, 0), + IceInternal::Property("IcePatch2Client.Remove", false, 0), + IceInternal::Property("IcePatch2Client.Thorough", false, 0), }; const IceInternal::PropertyArray diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 49f179b6772..0c0632ae728 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -8,7 +8,7 @@ // ********************************************************************** // -// Generated by makeprops.py from file ./config/PropertyNames.xml, Fri Jan 18 16:16:35 2013 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Jan 24 22:31:36 2013 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IcePatch2/Client.cpp b/cpp/src/IcePatch2/Client.cpp index e8ea78897b2..a4d2d6e7b74 100644 --- a/cpp/src/IcePatch2/Client.cpp +++ b/cpp/src/IcePatch2/Client.cpp @@ -263,7 +263,7 @@ Client::run(int argc, char* argv[]) } if(opts.isSet("thorough")) { - properties->setProperty("IcePatch2.Thorough", "1"); + properties->setProperty("IcePatch2Client.Thorough", "1"); } if(args.size() > 1) @@ -274,7 +274,7 @@ Client::run(int argc, char* argv[]) } if(args.size() == 1) { - properties->setProperty("IcePatch2.Directory", simplify(args[0])); + properties->setProperty("IcePatch2Client.Directory", simplify(args[0])); } bool aborted = false; diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp index 3e829cc3867..6d50a9215b0 100644 --- a/cpp/src/IcePatch2Lib/ClientUtil.cpp +++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp @@ -145,12 +145,117 @@ private: } +namespace +{ + +string +getDataDir(const CommunicatorPtr& communicator, const string& defaultValue) +{ + const string property = "IcePatch2Client.Directory"; + const string deprecatedProperty = "IcePatch2.Directory"; + + if(communicator->getProperties()->getProperty(property).empty() && + communicator->getProperties()->getProperty(deprecatedProperty).empty()) + { + return defaultValue; + } + + string value = communicator->getProperties()->getProperty(property); + if(value.empty()) + { + value = communicator->getProperties()->getProperty(deprecatedProperty); + ostringstream os; + os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead."; + communicator->getLogger()->warning(os.str()); + } + assert(!value.empty()); + return value; +} + +int +getThorough(const CommunicatorPtr& communicator, int defaultValue) +{ + const string property = "IcePatch2Client.Thorough"; + const string deprecatedProperty = "IcePatch2.Thorough"; + + if(communicator->getProperties()->getProperty(property).empty() && + communicator->getProperties()->getProperty(deprecatedProperty).empty()) + { + return defaultValue; + } + + if(!communicator->getProperties()->getProperty(property).empty()) + { + return communicator->getProperties()->getPropertyAsInt(property); + } + else + { + ostringstream os; + os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead."; + communicator->getLogger()->warning(os.str()); + return communicator->getProperties()->getPropertyAsInt(deprecatedProperty); + } +} + +int +getChunkSize(const CommunicatorPtr& communicator, int defaultValue) +{ + const string property = "IcePatch2Client.ChunkSize"; + const string deprecatedProperty = "IcePatch2.ChunkSize"; + + if(communicator->getProperties()->getProperty(property).empty() && + communicator->getProperties()->getProperty(deprecatedProperty).empty()) + { + return defaultValue; + } + + if(!communicator->getProperties()->getProperty(property).empty()) + { + return communicator->getProperties()->getPropertyAsInt(property); + } + else + { + ostringstream os; + os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead."; + communicator->getLogger()->warning(os.str()); + return communicator->getProperties()->getPropertyAsInt(deprecatedProperty); + } +} + +int +getRemove(const CommunicatorPtr& communicator, int defaultValue) +{ + const string property = "IcePatch2Client.Remove"; + const string deprecatedProperty = "IcePatch2.Remove"; + + if(communicator->getProperties()->getProperty(property).empty() && + communicator->getProperties()->getProperty(deprecatedProperty).empty()) + { + return defaultValue; + } + + if(!communicator->getProperties()->getProperty(property).empty()) + { + return communicator->getProperties()->getPropertyAsInt(property); + } + else + { + ostringstream os; + os << "The property " << deprecatedProperty << " is deprecated, use " << property << " instead."; + communicator->getLogger()->warning(os.str()); + return communicator->getProperties()->getPropertyAsInt(deprecatedProperty); + } +} + +} + + IcePatch2::Patcher::Patcher(const CommunicatorPtr& communicator, const PatcherFeedbackPtr& feedback) : _feedback(feedback), - _dataDir(communicator->getProperties()->getPropertyWithDefault("IcePatch2.Directory", ".")), - _thorough(communicator->getProperties()->getPropertyAsInt("IcePatch2.Thorough") > 0), - _chunkSize(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.ChunkSize", 100)), - _remove(communicator->getProperties()->getPropertyAsIntWithDefault("IcePatch2.Remove", 1)), + _dataDir(getDataDir(communicator, ".")), + _thorough(getThorough(communicator, 0) > 0), + _chunkSize(getChunkSize(communicator, 100)), + _remove(getRemove(communicator, 1)), _log(0) { const PropertiesPtr properties = communicator->getProperties(); @@ -601,7 +706,7 @@ IcePatch2::Patcher::removeFiles(const FileInfoSeq& files) } catch(...) { - if(_remove < 2) // We ignore errors if IcePatch2.Remove >= 2. + if(_remove < 2) // We ignore errors if IcePatch2Client.Remove >= 2. { throw; } |