mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-27 16:29:44 -05:00
Maintain entry history when merging databases (#970)
This commit is contained in:
parent
8e7fa3d3d6
commit
4b6dbcaec4
@ -667,7 +667,7 @@ void Group::merge(const Group* other)
|
|||||||
for (Entry* entry : dbEntries) {
|
for (Entry* entry : dbEntries) {
|
||||||
// entries are searched by uuid
|
// entries are searched by uuid
|
||||||
if (!findEntryByUuid(entry->uuid())) {
|
if (!findEntryByUuid(entry->uuid())) {
|
||||||
entry->clone(Entry::CloneNoFlags)->setGroup(this);
|
entry->clone(Entry::CloneIncludeHistory)->setGroup(this);
|
||||||
} else {
|
} else {
|
||||||
resolveConflict(findEntryByUuid(entry->uuid()), entry);
|
resolveConflict(findEntryByUuid(entry->uuid()), entry);
|
||||||
}
|
}
|
||||||
@ -891,11 +891,11 @@ void Group::resolveConflict(Entry* existingEntry, Entry* otherEntry)
|
|||||||
case KeepBoth:
|
case KeepBoth:
|
||||||
// if one entry is newer, create a clone and add it to the group
|
// if one entry is newer, create a clone and add it to the group
|
||||||
if (timeExisting > timeOther) {
|
if (timeExisting > timeOther) {
|
||||||
clonedEntry = otherEntry->clone(Entry::CloneNoFlags);
|
clonedEntry = otherEntry->clone(Entry::CloneIncludeHistory);
|
||||||
clonedEntry->setGroup(this);
|
clonedEntry->setGroup(this);
|
||||||
markOlderEntry(clonedEntry);
|
markOlderEntry(clonedEntry);
|
||||||
} else if (timeExisting < timeOther) {
|
} else if (timeExisting < timeOther) {
|
||||||
clonedEntry = otherEntry->clone(Entry::CloneNoFlags);
|
clonedEntry = otherEntry->clone(Entry::CloneIncludeHistory);
|
||||||
clonedEntry->setGroup(this);
|
clonedEntry->setGroup(this);
|
||||||
markOlderEntry(existingEntry);
|
markOlderEntry(existingEntry);
|
||||||
}
|
}
|
||||||
@ -904,7 +904,7 @@ void Group::resolveConflict(Entry* existingEntry, Entry* otherEntry)
|
|||||||
if (timeExisting < timeOther) {
|
if (timeExisting < timeOther) {
|
||||||
// only if other entry is newer, replace existing one
|
// only if other entry is newer, replace existing one
|
||||||
removeEntry(existingEntry);
|
removeEntry(existingEntry);
|
||||||
clonedEntry = otherEntry->clone(Entry::CloneNoFlags);
|
clonedEntry = otherEntry->clone(Entry::CloneIncludeHistory);
|
||||||
clonedEntry->setGroup(this);
|
clonedEntry->setGroup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user