From 4180a7609fb8927bf3f9bb78bf83f003c83e841d Mon Sep 17 00:00:00 2001 From: lina Date: Thu, 30 May 2019 10:11:31 +0300 Subject: [PATCH] Initial fix for case 1148796 --- P4Plugin/Source/P4StatusBaseCommand.cpp | 15 +++++++++++---- Test/Perforce/Status.test | 13 ++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/P4Plugin/Source/P4StatusBaseCommand.cpp b/P4Plugin/Source/P4StatusBaseCommand.cpp index 2e7d35a..2c0d533 100644 --- a/P4Plugin/Source/P4StatusBaseCommand.cpp +++ b/P4Plugin/Source/P4StatusBaseCommand.cpp @@ -15,6 +15,7 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList ) const std::string invalidPath = "//..."; const std::string notFound = " - no such file(s)."; + const std::string notInClientView = " - file(s) not in client view."; int i; StrRef var, val; @@ -40,7 +41,7 @@ void P4StatusBaseCommand::OutputStat( StrDict *varList ) std::string value(val.Text()); // Conn().Log().Debug() << key << " # " << value << Endl; - if (EndsWith(value, notFound) && !StartsWith(key, invalidPath)) + if ((EndsWith(value, notInClientView) || EndsWith(value, notFound)) && !StartsWith(key, invalidPath)) { if (!AddUnknown(current, value)) return; // invalid file @@ -139,13 +140,14 @@ void P4StatusBaseCommand::HandleError( Error *err ) const std::string invalidPath = "//..."; const std::string notFound = " - no such file(s)."; + const std::string notInClientView = " - file(s) not in client view."; std::string value(buf.Text()); value = TrimEnd(value, '\n'); VersionedAsset asset; - if (EndsWith(value, notFound)) + if (EndsWith(value, notFound) || EndsWith(value, notInClientView)) { - if (StartsWith(value, invalidPath) || EndsWith(value.substr(0, value.length() - notFound.length()), "...")) + if (StartsWith(value, invalidPath) || EndsWith(value.substr(0, value.length() - notFound.length()), "...") || EndsWith(value.substr(0, value.length() - notInClientView.length()), "...")) { // tried to get status with no files matching wildcard //... which is ok // or @@ -178,8 +180,13 @@ void P4StatusBaseCommand::HandleError( Error *err ) bool P4StatusBaseCommand::AddUnknown(VersionedAsset& current, const std::string& value) { const std::string notFound = " - no such file(s)."; + const std::string notInClientView = " - file(s) not in client view."; + + if (EndsWith(value, notFound)) + current.SetPath(WildcardsRemove(value.substr(0, value.length() - notFound.length()))); + else if (EndsWith(value, notInClientView)) + current.SetPath(WildcardsRemove(value.substr(0, value.length() - notInClientView.length()))); - current.SetPath(WildcardsRemove(value.substr(0, value.length() - notFound.length()))); if (EndsWith(current.GetPath(), "*")) return false; // skip invalid files return true; diff --git a/Test/Perforce/Status.test b/Test/Perforce/Status.test index edca763..f06be05 100644 --- a/Test/Perforce/Status.test +++ b/Test/Perforce/Status.test @@ -90,7 +90,9 @@ v1:fstat "./Assets/testfile.txt" "./Assets/excludedfile.txt" v1:/Assets/testfile.txt o1:/Assets/testfile.txt o1:257 -/Assets/testfile.txt o1:/Assets/testfile.txt o1:257 +o1:./Assets/excludedfile.txt +o1:0 +v1:./Assets/excludedfile.txt - file(s) not in client view. d1:end of list r1:end of response -- @@ -124,6 +129,8 @@ v1:fstat "./Assets/testfile.txt" "./Assets/excludedfile.txt" v1:/Assets/testfile.txt o1:/Assets/testfile.txt o1:257 -