ctest_update: Tell svn not to prompt interactively (#13024)
While at it, add SVNOptions/CTEST_SVN_OPTIONS configuration settings to add options to all svn invocations instead of just "svn update".
This commit is contained in:
parent
eb5da9c71d
commit
9ace801578
|
@ -44,6 +44,7 @@ CVSUpdateOptions: @CVS_UPDATE_OPTIONS@
|
||||||
|
|
||||||
# Subversion options
|
# Subversion options
|
||||||
SVNCommand: @SVNCOMMAND@
|
SVNCommand: @SVNCOMMAND@
|
||||||
|
SVNOptions: @CTEST_SVN_OPTIONS@
|
||||||
SVNUpdateOptions: @SVN_UPDATE_OPTIONS@
|
SVNUpdateOptions: @SVN_UPDATE_OPTIONS@
|
||||||
|
|
||||||
# Git options
|
# Git options
|
||||||
|
|
|
@ -38,11 +38,11 @@ cmCTestSVN::~cmCTestSVN()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmCTestSVN::CleanupImpl()
|
void cmCTestSVN::CleanupImpl()
|
||||||
{
|
{
|
||||||
const char* svn = this->CommandLineTool.c_str();
|
std::vector<const char*> svn_cleanup;
|
||||||
const char* svn_cleanup[] = {svn, "cleanup", 0};
|
svn_cleanup.push_back("cleanup");
|
||||||
OutputLogger out(this->Log, "cleanup-out> ");
|
OutputLogger out(this->Log, "cleanup-out> ");
|
||||||
OutputLogger err(this->Log, "cleanup-err> ");
|
OutputLogger err(this->Log, "cleanup-err> ");
|
||||||
this->RunChild(svn_cleanup, &out, &err);
|
this->RunSVNCommand(svn_cleanup, &out, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -106,12 +106,13 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2)
|
||||||
std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo)
|
std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo)
|
||||||
{
|
{
|
||||||
// Run "svn info" to get the repository info from the work tree.
|
// Run "svn info" to get the repository info from the work tree.
|
||||||
const char* svn = this->CommandLineTool.c_str();
|
std::vector<const char*> svn_info;
|
||||||
const char* svn_info[] = {svn, "info", svninfo.LocalPath.c_str(), 0};
|
svn_info.push_back("info");
|
||||||
|
svn_info.push_back(svninfo.LocalPath.c_str());
|
||||||
std::string rev;
|
std::string rev;
|
||||||
InfoParser out(this, "info-out> ", rev, svninfo);
|
InfoParser out(this, "info-out> ", rev, svninfo);
|
||||||
OutputLogger err(this->Log, "info-err> ");
|
OutputLogger err(this->Log, "info-err> ");
|
||||||
this->RunChild(svn_info, &out, &err);
|
this->RunSVNCommand(svn_info, &out, &err);
|
||||||
return rev;
|
return rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,19 +286,52 @@ bool cmCTestSVN::UpdateImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<char const*> svn_update;
|
std::vector<char const*> svn_update;
|
||||||
svn_update.push_back(this->CommandLineTool.c_str());
|
|
||||||
svn_update.push_back("update");
|
svn_update.push_back("update");
|
||||||
svn_update.push_back("--non-interactive");
|
|
||||||
for(std::vector<cmStdString>::const_iterator ai = args.begin();
|
for(std::vector<cmStdString>::const_iterator ai = args.begin();
|
||||||
ai != args.end(); ++ai)
|
ai != args.end(); ++ai)
|
||||||
{
|
{
|
||||||
svn_update.push_back(ai->c_str());
|
svn_update.push_back(ai->c_str());
|
||||||
}
|
}
|
||||||
svn_update.push_back(0);
|
|
||||||
|
|
||||||
UpdateParser out(this, "up-out> ");
|
UpdateParser out(this, "up-out> ");
|
||||||
OutputLogger err(this->Log, "up-err> ");
|
OutputLogger err(this->Log, "up-err> ");
|
||||||
return this->RunUpdateCommand(&svn_update[0], &out, &err);
|
return this->RunSVNCommand(svn_update, &out, &err);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
bool cmCTestSVN::RunSVNCommand(std::vector<char const*> const& parameters,
|
||||||
|
OutputParser* out, OutputParser* err)
|
||||||
|
{
|
||||||
|
if(parameters.empty()) return false;
|
||||||
|
|
||||||
|
std::vector<char const*> args;
|
||||||
|
args.push_back(this->CommandLineTool.c_str());
|
||||||
|
|
||||||
|
args.insert(args.end(), parameters.begin(), parameters.end());
|
||||||
|
|
||||||
|
args.push_back("--non-interactive");
|
||||||
|
|
||||||
|
std::string userOptions =
|
||||||
|
this->CTest->GetCTestConfiguration("SVNOptions");
|
||||||
|
|
||||||
|
std::vector<cmStdString> parsedUserOptions =
|
||||||
|
cmSystemTools::ParseArguments(userOptions.c_str());
|
||||||
|
for(std::vector<cmStdString>::iterator i = parsedUserOptions.begin();
|
||||||
|
i != parsedUserOptions.end(); ++i)
|
||||||
|
{
|
||||||
|
args.push_back(i->c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
args.push_back(0);
|
||||||
|
|
||||||
|
if(strcmp(parameters[0], "update") == 0)
|
||||||
|
{
|
||||||
|
return RunUpdateCommand(&args[0], out, err);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return RunChild(&args[0], out, err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -417,14 +451,15 @@ void cmCTestSVN::LoadRevisions(SVNInfo &svninfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run "svn log" to get all global revisions of interest.
|
// Run "svn log" to get all global revisions of interest.
|
||||||
const char* svn = this->CommandLineTool.c_str();
|
std::vector<const char*> svn_log;
|
||||||
const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(),
|
svn_log.push_back("log");
|
||||||
svninfo.LocalPath.c_str(), 0};
|
svn_log.push_back("--xml");
|
||||||
{
|
svn_log.push_back("-v");
|
||||||
|
svn_log.push_back(revs.c_str());
|
||||||
|
svn_log.push_back(svninfo.LocalPath.c_str());
|
||||||
LogParser out(this, "log-out> ", svninfo);
|
LogParser out(this, "log-out> ", svninfo);
|
||||||
OutputLogger err(this->Log, "log-err> ");
|
OutputLogger err(this->Log, "log-err> ");
|
||||||
this->RunChild(svn_log, &out, &err);
|
this->RunSVNCommand(svn_log, &out, &err);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -492,11 +527,11 @@ private:
|
||||||
void cmCTestSVN::LoadModifications()
|
void cmCTestSVN::LoadModifications()
|
||||||
{
|
{
|
||||||
// Run "svn status" which reports local modifications.
|
// Run "svn status" which reports local modifications.
|
||||||
const char* svn = this->CommandLineTool.c_str();
|
std::vector<const char*> svn_status;
|
||||||
const char* svn_status[] = {svn, "status", "--non-interactive", 0};
|
svn_status.push_back("status");
|
||||||
StatusParser out(this, "status-out> ");
|
StatusParser out(this, "status-out> ");
|
||||||
OutputLogger err(this->Log, "status-err> ");
|
OutputLogger err(this->Log, "status-err> ");
|
||||||
this->RunChild(svn_status, &out, &err);
|
this->RunSVNCommand(svn_status, &out, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -550,11 +585,11 @@ private:
|
||||||
void cmCTestSVN::LoadExternals()
|
void cmCTestSVN::LoadExternals()
|
||||||
{
|
{
|
||||||
// Run "svn status" to get the list of external repositories
|
// Run "svn status" to get the list of external repositories
|
||||||
const char* svn = this->CommandLineTool.c_str();
|
std::vector<const char*> svn_status;
|
||||||
const char* svn_status[] = {svn, "status", 0};
|
svn_status.push_back("status");
|
||||||
ExternalParser out(this, "external-out> ");
|
ExternalParser out(this, "external-out> ");
|
||||||
OutputLogger err(this->Log, "external-err> ");
|
OutputLogger err(this->Log, "external-err> ");
|
||||||
this->RunChild(svn_status, &out, &err);
|
this->RunSVNCommand(svn_status, &out, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -33,6 +33,9 @@ private:
|
||||||
virtual void NoteNewRevision();
|
virtual void NoteNewRevision();
|
||||||
virtual bool UpdateImpl();
|
virtual bool UpdateImpl();
|
||||||
|
|
||||||
|
bool RunSVNCommand(std::vector<char const*> const& parameters,
|
||||||
|
OutputParser* out, OutputParser* err);
|
||||||
|
|
||||||
// Information about an SVN repository (root repository or external)
|
// Information about an SVN repository (root repository or external)
|
||||||
struct SVNInfo {
|
struct SVNInfo {
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ cmCTestGenericHandler* cmCTestUpdateCommand::InitializeHandler()
|
||||||
"SVNCommand", "CTEST_SVN_COMMAND");
|
"SVNCommand", "CTEST_SVN_COMMAND");
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
"SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
|
"SVNUpdateOptions", "CTEST_SVN_UPDATE_OPTIONS");
|
||||||
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
|
"SVNOptions", "CTEST_SVN_OPTIONS");
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
"BZRCommand", "CTEST_BZR_COMMAND");
|
"BZRCommand", "CTEST_BZR_COMMAND");
|
||||||
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
|
||||||
|
|
Loading…
Reference in New Issue