diff options
author | Orgad Shaneh <orgads@gmail.com> | 2019-05-17 10:18:22 +0000 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2019-05-17 10:31:47 +0000 |
commit | 428a097f347c949ecb727023bbee08e5dcff4e0c (patch) | |
tree | 6784a70f148312e3f01a2e85f97beb169737eeed | |
parent | 9cf336b4bce0744ad146f8c3a5f9fe02638461bd (diff) |
Revert "Perforce: Allow working with localhost server"
It breaks the common use-case.
Running p4 client -o in any directory returns Host,
even if it is not managed by Perforce.
This reverts commit 28f7c7935f4d142d5498d58465ff004462e996a6.
Fixes: QTCREATORBUG-22458
Change-Id: Iaa84ff68e2c6d807c6c177ff2113b07380b4e5be
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
-rw-r--r-- | src/plugins/perforce/perforcechecker.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/perforce/perforcechecker.cpp b/src/plugins/perforce/perforcechecker.cpp index 92dd5a4cc4..87b02e6ef3 100644 --- a/src/plugins/perforce/perforcechecker.cpp +++ b/src/plugins/perforce/perforcechecker.cpp @@ -175,6 +175,17 @@ static inline QString clientRootFromOutput(const QString &in) return QString(); } +// When p4 port and p4 user is set a preconfigured Root: is given, which doesn't relate with +// the current mapped project. In this case "Client:" has the same value as "Host:", which is an +// invalid case. +static inline bool clientAndHostAreEqual(const QString &in) +{ + QString client = findTerm(in, QLatin1String("Client:")); + QString host = findTerm(in, QLatin1String("Host:")); + + return client == host; +} + void PerforceChecker::parseOutput(const QString &response) { if (!response.contains(QLatin1String("View:")) && !response.contains(QLatin1String("//depot/"))) { @@ -182,6 +193,12 @@ void PerforceChecker::parseOutput(const QString &response) return; } + if (clientAndHostAreEqual(response)) { + // Is an invalid case. But not an error. QtC checks cmake install directories for + // p4 repositories, or the %temp% directory. + return; + } + const QString repositoryRoot = clientRootFromOutput(response); if (repositoryRoot.isEmpty()) { //: Unable to determine root of the p4 client installation |