From 8845683197faa2d9a48e8714b43ff4360f4e767d Mon Sep 17 00:00:00 2001 From: Tom Deblauwe Date: Mon, 24 Mar 2014 15:53:35 +0100 Subject: [PATCH] Add CurrentProject:VcsTopLevelPath as a variable. Change-Id: I46ed1c0711cc9cc23f82628e8e9dcd82b1112fad Reviewed-by: Orgad Shaneh Reviewed-by: Tobias Hunger --- src/plugins/vcsbase/vcsbaseconstants.h | 1 + src/plugins/vcsbase/vcsplugin.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/plugins/vcsbase/vcsbaseconstants.h b/src/plugins/vcsbase/vcsbaseconstants.h index 1dd5c8a9936..2e0d494ddb8 100644 --- a/src/plugins/vcsbase/vcsbaseconstants.h +++ b/src/plugins/vcsbase/vcsbaseconstants.h @@ -51,6 +51,7 @@ const char VCS_ID_CVS[] = "Z.CVS"; const char VAR_VCS_NAME[] = "CurrentProject:VcsName"; const char VAR_VCS_TOPIC[] = "CurrentProject:VcsTopic"; +const char VAR_VCS_TOPLEVELPATH[] = "CurrentProject:VcsTopLevelPath"; } // namespace Constants } // namespace VcsBase diff --git a/src/plugins/vcsbase/vcsplugin.cpp b/src/plugins/vcsbase/vcsplugin.cpp index 406aad3a811..cabda189fd5 100644 --- a/src/plugins/vcsbase/vcsplugin.cpp +++ b/src/plugins/vcsbase/vcsplugin.cpp @@ -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.")); Core::VariableManager::registerVariable(Constants::VAR_VCS_TOPIC, 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; } @@ -167,6 +169,11 @@ void VcsPlugin::updateVariable(const QByteArray &variable) Core::VariableManager::insert(variable, cachedVc->vcsTopic(cachedTopLevel)); else Core::VariableManager::remove(variable); + } else if (variable == Constants::VAR_VCS_TOPLEVELPATH) { + if (cachedVc) + Core::VariableManager::insert(variable, cachedTopLevel); + else + Core::VariableManager::remove(variable); } }