Add CurrentProject:VcsTopLevelPath as a variable.

Change-Id: I46ed1c0711cc9cc23f82628e8e9dcd82b1112fad
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tom Deblauwe
2014-03-24 15:53:35 +01:00
committed by Tobias Hunger
parent a3da1dfce5
commit 8845683197
2 changed files with 8 additions and 0 deletions

View File

@@ -51,6 +51,7 @@ const char VCS_ID_CVS[] = "Z.CVS";
const char VAR_VCS_NAME[] = "CurrentProject:VcsName"; const char VAR_VCS_NAME[] = "CurrentProject:VcsName";
const char VAR_VCS_TOPIC[] = "CurrentProject:VcsTopic"; const char VAR_VCS_TOPIC[] = "CurrentProject:VcsTopic";
const char VAR_VCS_TOPLEVELPATH[] = "CurrentProject:VcsTopLevelPath";
} // namespace Constants } // namespace Constants
} // namespace VcsBase } // namespace VcsBase

View File

@@ -90,6 +90,8 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Name of the version control system in use by the current project.")); tr("Name of the version control system in use by the current project."));
Core::VariableManager::registerVariable(Constants::VAR_VCS_TOPIC, Core::VariableManager::registerVariable(Constants::VAR_VCS_TOPIC,
tr("The current version control topic (branch or tag) identification of the current project.")); tr("The current version control topic (branch or tag) identification of the current project."));
Core::VariableManager::registerVariable(Constants::VAR_VCS_TOPLEVELPATH,
tr("The top level path to the repository the current project is in."));
return true; return true;
} }
@@ -167,6 +169,11 @@ void VcsPlugin::updateVariable(const QByteArray &variable)
Core::VariableManager::insert(variable, cachedVc->vcsTopic(cachedTopLevel)); Core::VariableManager::insert(variable, cachedVc->vcsTopic(cachedTopLevel));
else else
Core::VariableManager::remove(variable); Core::VariableManager::remove(variable);
} else if (variable == Constants::VAR_VCS_TOPLEVELPATH) {
if (cachedVc)
Core::VariableManager::insert(variable, cachedTopLevel);
else
Core::VariableManager::remove(variable);
} }
} }