Skip to content

Commit

Permalink
revert function return value
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Oct 3, 2023
1 parent b7f8e71 commit 43f74b1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
29 changes: 14 additions & 15 deletions core/merginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ bool MerginApi::hasLocalProjectChanges( const QString &projectDir )

MerginConfig config = MerginConfig::fromFile( projectDir + "/" + sMerginConfigFile );

return projectFilesEqual( projectMetadata.files, localFiles, projectDir );
return hasLocalChanges( projectMetadata.files, localFiles, projectDir );
}

QString MerginApi::getTempProjectDir( const QString &projectFullName )
Expand Down Expand Up @@ -2814,12 +2814,17 @@ void MerginApi::getWorkspaceInfoReplyFinished()
r->deleteLater();
}

bool MerginApi::projectFilesEqual(
bool MerginApi::hasLocalChanges(
const QList<MerginFile> &oldServerFiles,
const QList<MerginFile> &localFiles,
const QString &projectDir
)
{
if (localFiles.count() != oldServerFiles.count())
{
return true;
}

QHash<QString, MerginFile> oldServerFilesMap;

for ( const MerginFile &file : oldServerFiles )
Expand All @@ -2835,7 +2840,7 @@ bool MerginApi::projectFilesEqual(
if ( !hasOldServer )
{
// L-A
return false;
return true;
}
else
{
Expand All @@ -2852,28 +2857,22 @@ bool MerginApi::projectFilesEqual(
if ( GeodiffUtils::hasPendingChanges( projectDir, filePath ) )
{
// L-U
return false;
return true;
}
}
else
{
// L-U
return false;
return true;
}
}
}

if ( hasOldServer )
oldServerFilesMap.remove( filePath );
}

if ( !oldServerFilesMap.empty() )
{
// L-D
return false;
}

return true;
// We know that the number of local files and old server is the same
// And also that all local files has old file counterpart
// So it is not possible that there is deleted local file at this point.
return false;
}

ProjectDiff MerginApi::compareProjectFiles(
Expand Down
4 changes: 2 additions & 2 deletions core/merginapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,13 @@ class MerginApi: public QObject
* - "old" server version (what was downloaded from server) - read from the project directory's stored metadata
* - local file version (what is currently in the project directory) - created on the fly from the local directory content
*
* The function returns false if:
* The function returns true if:
* - there is any local file not present in "old" server version files
* - there is any local file missing in "old" server version files
* - there is different checksum of any non-diffable file (e.g. CSV file)
* - there is different content of any diffable file (e.g. GeoPackage)
*/
static bool projectFilesEqual(
static bool hasLocalChanges(
const QList<MerginFile> &oldServerFiles,
const QList<MerginFile> &localFiles,
const QString &projectDir
Expand Down

1 comment on commit 43f74b1

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.10.462011 just submitted!

Please sign in to comment.