Introduce synchronize merge method
* Create history-based merging that keeps older data in history instead of discarding or deleting it * Extract merge logic into the Merger class * Allows special merge behavior * Improve handling of deletion and changes on groups * Enable basic change tracking while merging * Prevent unintended timestamp changes while merging * Handle differences in timestamp precision * Introduce comparison operators to allow for more sophisticated comparisons (ignore special properties, ...) * Introduce Clock class to handle datetime across the app Merge Strategies: * Default (use inherited/fallback method) * Duplicate (duplicate conflicting nodes, apply all deletions) * KeepLocal (use local values, but apply all deletions) * KeepRemote (use remote values, but apply all deletions) * KeepNewer (merge history only) * Synchronize (merge history, newest value stays on top, apply all deletions)
This commit is contained in:
committed by
Jonathan White
parent
b40e5686dc
commit
c1e9f45df9
@@ -92,7 +92,6 @@ void TestGui::initTestCase()
|
||||
Tools::wait(50);
|
||||
|
||||
// Load the NewDatabase.kdbx file into temporary storage
|
||||
QByteArray tmpData;
|
||||
QFile sourceDbFile(QString(KEEPASSX_TEST_DATA_DIR).append("/NewDatabase.kdbx"));
|
||||
QVERIFY(sourceDbFile.open(QIODevice::ReadOnly));
|
||||
QVERIFY(Tools::readAllFromDevice(&sourceDbFile, m_dbData));
|
||||
@@ -292,17 +291,17 @@ void TestGui::testAutoreloadDatabase()
|
||||
config()->set("AutoReloadOnChange", false);
|
||||
|
||||
// Load the MergeDatabase.kdbx file into temporary storage
|
||||
QByteArray tmpData;
|
||||
QByteArray unmodifiedMergeDatabase;
|
||||
QFile mergeDbFile(QString(KEEPASSX_TEST_DATA_DIR).append("/MergeDatabase.kdbx"));
|
||||
QVERIFY(mergeDbFile.open(QIODevice::ReadOnly));
|
||||
QVERIFY(Tools::readAllFromDevice(&mergeDbFile, tmpData));
|
||||
QVERIFY(Tools::readAllFromDevice(&mergeDbFile, unmodifiedMergeDatabase));
|
||||
mergeDbFile.close();
|
||||
|
||||
// Test accepting new file in autoreload
|
||||
MessageBox::setNextAnswer(QMessageBox::Yes);
|
||||
// Overwrite the current database with the temp data
|
||||
QVERIFY(m_dbFile.open());
|
||||
QVERIFY(m_dbFile.write(tmpData, static_cast<qint64>(tmpData.size())));
|
||||
QVERIFY(m_dbFile.write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile.close();
|
||||
Tools::wait(1500);
|
||||
|
||||
@@ -320,7 +319,7 @@ void TestGui::testAutoreloadDatabase()
|
||||
MessageBox::setNextAnswer(QMessageBox::No);
|
||||
// Overwrite the current temp database with a new file
|
||||
m_dbFile.open();
|
||||
QVERIFY(m_dbFile.write(tmpData, static_cast<qint64>(tmpData.size())));
|
||||
QVERIFY(m_dbFile.write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile.close();
|
||||
Tools::wait(1500);
|
||||
|
||||
@@ -337,7 +336,6 @@ void TestGui::testAutoreloadDatabase()
|
||||
// Test accepting a merge of edits into autoreload
|
||||
// Turn on autoload so we only get one messagebox (for the merge)
|
||||
config()->set("AutoReloadOnChange", true);
|
||||
|
||||
// Modify some entries
|
||||
testEditEntry();
|
||||
|
||||
@@ -345,7 +343,7 @@ void TestGui::testAutoreloadDatabase()
|
||||
MessageBox::setNextAnswer(QMessageBox::Yes);
|
||||
// Overwrite the current database with the temp data
|
||||
QVERIFY(m_dbFile.open());
|
||||
QVERIFY(m_dbFile.write(tmpData, static_cast<qint64>(tmpData.size())));
|
||||
QVERIFY(m_dbFile.write(unmodifiedMergeDatabase, static_cast<qint64>(unmodifiedMergeDatabase.size())));
|
||||
m_dbFile.close();
|
||||
Tools::wait(1500);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user