Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2024-11-14 15:40:14 -05:00
commit 32c39f3518

View File

@ -1522,6 +1522,8 @@ public class GhidraFileData {
monitor.setMessage("Updating local checkout file..."); monitor.setMessage("Updating local checkout file...");
} }
folderItem.updateCheckout(versionedFolderItem, !quickCheckin, monitor); folderItem.updateCheckout(versionedFolderItem, !quickCheckin, monitor);
versionedFolderItem.updateCheckoutVersion(folderItem.getCheckoutId(),
folderItem.getCheckoutVersion(), ClientUtil.getUserName());
success = true; success = true;
} }
finally { finally {
@ -1929,11 +1931,14 @@ public class GhidraFileData {
ContentHandler<?> contentHandler = getContentHandler(); ContentHandler<?> contentHandler = getContentHandler();
long checkoutId = folderItem.getCheckoutId();
if (!modifiedSinceCheckout()) { if (!modifiedSinceCheckout()) {
// Quick merge // Quick database update of local folder item
folderItem.updateCheckout(versionedFolderItem, true, monitor); folderItem.updateCheckout(versionedFolderItem, true, monitor);
} }
else { else {
// Perform interactive merge
if (SystemUtilities.isInHeadlessMode()) { if (SystemUtilities.isInHeadlessMode()) {
throw new IOException("Merge failed, merge is not supported in headless mode"); throw new IOException("Merge failed, merge is not supported in headless mode");
@ -1966,7 +1971,6 @@ public class GhidraFileData {
bufferFile.dispose(); bufferFile.dispose();
} }
int coVer = folderItem.getCheckoutVersion(); int coVer = folderItem.getCheckoutVersion();
long checkoutId = folderItem.getCheckoutId();
tmpItem.setCheckout(checkoutId, folderItem.isCheckedOutExclusive(), mergeVer, 0); tmpItem.setCheckout(checkoutId, folderItem.isCheckedOutExclusive(), mergeVer, 0);
@ -2002,13 +2006,15 @@ public class GhidraFileData {
release(latestObj); release(latestObj);
} }
// Update folder item // Update local folder item using temporary file content
folderItem.updateCheckout(tmpItem, mergeVer); folderItem.updateCheckout(tmpItem, mergeVer);
versionedFolderItem.updateCheckoutVersion(checkoutId, mergeVer, tmpItem = null; // update removes temporary file if successful
ClientUtil.getUserName());
tmpItem = null;
} }
// update checkout data within versioned repository
versionedFolderItem.updateCheckoutVersion(checkoutId,
folderItem.getCheckoutVersion(), ClientUtil.getUserName());
Msg.info(this, "Updated checkout completed for " + name); Msg.info(this, "Updated checkout completed for " + name);
if (inUseDomainObj != null) { if (inUseDomainObj != null) {
@ -2023,6 +2029,7 @@ public class GhidraFileData {
mergeInProgress = false; mergeInProgress = false;
try { try {
if (tmpItem != null) { if (tmpItem != null) {
// remove temporary merge file if error occured
try { try {
tmpItem.delete(-1, ClientUtil.getUserName()); tmpItem.delete(-1, ClientUtil.getUserName());
} }