GP-4921 fixed change markers after a check-in with the program open in the tool

This commit is contained in:
ghidragon 2024-09-18 13:38:38 -04:00 committed by ghidra1
parent f292bad0ed
commit 42462a3258
3 changed files with 34 additions and 27 deletions

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -279,7 +279,7 @@ public class MyProgramChangesDisplayPlugin extends ProgramPlugin implements Doma
} }
if (isTrackingServerChanges()) { if (isTrackingServerChanges()) {
if (programSaved) { if (programSaved || programChangedRemotely) {
currentChangesSinceCheckoutMarks currentChangesSinceCheckoutMarks
.setAddressSetCollection(changeSet.getAddressSetCollectionSinceCheckout()); .setAddressSetCollection(changeSet.getAddressSetCollectionSinceCheckout());
} }

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -78,7 +78,7 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
bf = dbItem.open(version, minChangeVersion); bf = dbItem.open(version, minChangeVersion);
dbh = new DBHandle(bf); dbh = new DBHandle(bf);
program = new ProgramDB(dbh, OpenMode.IMMUTABLE, monitor, consumer); program = new ProgramDB(dbh, OpenMode.IMMUTABLE, monitor, consumer);
getProgramChangeSet(program, bf); loadProgramChangeSet(program, bf);
success = true; success = true;
return program; return program;
} }
@ -130,7 +130,7 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
dbh = new DBHandle(bf); dbh = new DBHandle(bf);
OpenMode openMode = okToUpgrade ? OpenMode.UPGRADE : OpenMode.UPDATE; OpenMode openMode = okToUpgrade ? OpenMode.UPGRADE : OpenMode.UPDATE;
program = new ProgramDB(dbh, openMode, monitor, consumer); program = new ProgramDB(dbh, openMode, monitor, consumer);
getProgramChangeSet(program, bf); loadProgramChangeSet(program, bf);
program.setProgramUserData(new ProgramUserDataDB(program)); program.setProgramUserData(new ProgramUserDataDB(program));
success = true; success = true;
return program; return program;
@ -184,7 +184,7 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
OpenMode openMode = okToUpgrade ? OpenMode.UPGRADE : OpenMode.UPDATE; OpenMode openMode = okToUpgrade ? OpenMode.UPGRADE : OpenMode.UPDATE;
program = new ProgramDB(dbh, openMode, monitor, consumer); program = new ProgramDB(dbh, openMode, monitor, consumer);
if (checkoutId == FolderItem.DEFAULT_CHECKOUT_ID) { if (checkoutId == FolderItem.DEFAULT_CHECKOUT_ID) {
getProgramChangeSet(program, bf); loadProgramChangeSet(program, bf);
} }
if (recover) { if (recover) {
recoverChangeSet(program, dbh); recoverChangeSet(program, dbh);
@ -255,9 +255,11 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
} }
} }
private ProgramDBChangeSet getProgramChangeSet(ProgramDB program, ManagedBufferFile bf) private ProgramDBChangeSet loadProgramChangeSet(ProgramDB program, ManagedBufferFile bf)
throws IOException { throws IOException {
ProgramDBChangeSet changeSet = (ProgramDBChangeSet) program.getChangeSet(); ProgramDBChangeSet changeSet = (ProgramDBChangeSet) program.getChangeSet();
changeSet.clearAll();
BufferFile cf = bf.getNextChangeDataFile(true); BufferFile cf = bf.getNextChangeDataFile(true);
DBHandle cfh = null; DBHandle cfh = null;
while (cf != null) { while (cf != null) {
@ -292,7 +294,7 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
bf = dbItem.open(toVer, fromVer); bf = dbItem.open(toVer, fromVer);
dbh = new DBHandle(bf); dbh = new DBHandle(bf);
program = new ProgramDB(dbh, OpenMode.IMMUTABLE, null, this); program = new ProgramDB(dbh, OpenMode.IMMUTABLE, null, this);
return getProgramChangeSet(program, bf); return loadProgramChangeSet(program, bf);
} }
catch (VersionException | IOException e) { catch (VersionException | IOException e) {
throw e; throw e;
@ -374,7 +376,7 @@ public class ProgramContentHandler extends DBWithUserDataContentHandler<ProgramD
} }
LocalManagedBufferFile bf = dbItem.openForUpdate(FolderItem.DEFAULT_CHECKOUT_ID); LocalManagedBufferFile bf = dbItem.openForUpdate(FolderItem.DEFAULT_CHECKOUT_ID);
program.getDBHandle().setDBVersionedSourceFile(bf); program.getDBHandle().setDBVersionedSourceFile(bf);
getProgramChangeSet(program, bf); loadProgramChangeSet(program, bf);
} }
} }

View File

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -361,25 +361,29 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
} }
if (!isCheckedOut) { // if not versioned, wipe out change sets if (!isCheckedOut) { // if not versioned, wipe out change sets
changedAddrsSinceCheckout.clear(); clearAll();
changedRegAddrsSinceCheckout.clear();
changedAddrsSinceSave.clear();
changedRegAddrsSinceSave.clear();
changedCategoryIds.clear();
changedDataTypeIds.clear();
changedProgramTreeIds.clear();
changedSymbolIds.clear();
changedSourceArchiveIds.clear();
addedCategoryIds.clear();
addedDataTypeIds.clear();
addedProgramTreeIds.clear();
addedSymbolIds.clear();
addedSourceArchiveIds.clear();
} }
clearUndo(); clearUndo();
} }
void clearAll() {
changedAddrsSinceCheckout.clear();
changedRegAddrsSinceCheckout.clear();
changedAddrsSinceSave.clear();
changedRegAddrsSinceSave.clear();
changedCategoryIds.clear();
changedDataTypeIds.clear();
changedProgramTreeIds.clear();
changedSymbolIds.clear();
changedSourceArchiveIds.clear();
addedCategoryIds.clear();
addedDataTypeIds.clear();
addedProgramTreeIds.clear();
addedSymbolIds.clear();
addedSourceArchiveIds.clear();
}
@Override @Override
public synchronized void startTransaction() { public synchronized void startTransaction() {
inTransaction = true; inTransaction = true;
@ -659,6 +663,7 @@ class ProgramDBChangeSet implements ProgramChangeSet, DomainObjectDBChangeSet {
} }
return true; return true;
} }
} }
class ChangeDiff { class ChangeDiff {