Cli: Bail early on 'repository commit' if changelog dir does not exist

refs #7255
This commit is contained in:
Michael Friedrich 2014-10-28 19:43:37 +01:00
parent 16069a7368
commit 20a176680a
3 changed files with 10 additions and 8 deletions

View File

@ -60,8 +60,10 @@ ImpersonationLevel RepositoryCommitCommand::GetImpersonationLevel(void) const
*/
int RepositoryCommitCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
{
/* create required repositories first, just in case */
Utility::MkDirP(RepositoryUtility::GetRepositoryChangeLogPath(), 0750);
if (!Utility::PathExists(RepositoryUtility::GetRepositoryChangeLogPath())) {
std::cout << "Repository Changelog path '" << RepositoryUtility::GetRepositoryChangeLogPath() << "' does not exist. Add objects first!\n";
return 1;
}
if (vm.count("simulate")) {
RepositoryUtility::PrintChangeLog(std::cout);

View File

@ -150,16 +150,16 @@ std::vector<String> RepositoryObjectCommand::GetPositionalSuggestions(const Stri
return CLICommand::GetPositionalSuggestions(word);
}
int RepositoryObjectCommand::GetMaxArguments(void) const
{
return -1;
}
ImpersonationLevel RepositoryObjectCommand::GetImpersonationLevel(void) const
{
return ImpersonateRoot;
}
int RepositoryObjectCommand::GetMaxArguments(void) const
{
return -1;
}
/**
* The entry point for the "repository <type> <add/remove/list>" CLI command.
*

View File

@ -629,7 +629,7 @@ void RepositoryUtility::SerializeObject(std::ostream& fp, const String& name, co
}
BOOST_FOREACH(const Dictionary::Pair& kv, object) {
if (kv.first == "import" || kv.first == "name") {
if (kv.first == "import" || kv.first == "name" || kv.first == "__name") {
continue;
} else {
fp << "\t" << kv.first << " = ";