-
-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update db search and replace to support working copies #8514
Update db search and replace to support working copies #8514
Conversation
5bcd1ee
to
e0c2829
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tylerjmchugh I got a bizarre case with the working copy:
-
Created a metadata with a contact individual name
Jose
and approved it. -
Edited it to create a working copy and changed the title to distinguish the metadata in batch edit XML preview.
-
Replaced
Jose
withJose 1
: updates the value in the working copy, but not in the approved version (correct).
The preview XML shows the correct replaced value, but the metadata title is the approved one. It seems the preview doesn't use the working copy. This should be checked.
- I updated again the metadata to change
Jose 1
toJose 2
, but then the working copy is updated with the approved version valueJose
instead ofJose 2
It seems the search and replace logic was applying the changes to the correct version but behind the scenes it was searching for the UUID on the MetadataRepository to get the updated metadata rather than using an IMetadataUtils method. I updated the draft repository to include the search and replace methods like the metadata repository has and implemented it in IMetadataUtils. These issues now seem to be resolved but I see a unit test is now failing for the regex replace. I will look into this. |
Fixed the unit test failure and issues with regex. Ready for review. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the changes and works fine.
The backport to
stderr
stdout
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.2.x 4.2.x
# Navigate to the new working tree
cd .worktrees/backport-4.2.x
# Create a new branch
git switch --create backport-8514-to-4.2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick e0c2829e33a1d0935bf3624bf020060505fa522b,c8ac524846b521fb34dc762ec64724bb73852ec1,f9b67accf76db0d0574d58eece5bf772cf3ae9ac,3b817274da8a4c34b1056fabb14450f1d42ef21b,f49e6f71dfcfcb932e7569ba12f52503e5025c42,762120e03c21fc3cbbbe3bf1a3ea5569449a53b0,8d09f1cd244a266111b6120c6fd61fb5777b3cb2,debe4396fc36c0bfb65d7afb14051f3a8ea1fa04,3be79184dba6a972da59602f87129f358a74a7fe
# Push it to GitHub
git push --set-upstream origin backport-8514-to-4.2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.2.x Then, create a pull request where the |
…es (geonetwork#8514) * Update db search and replace API to allow replacements on working copies * Remove param * retrigger checks * retrigger checks * Update db search and replace preview API to allow replacements on working copies * Update search and replace logic to use the correct repository * Remove unused import * Update selectOneWithSearchAndReplace to fallback to non-draft repository * Fix calling wrong method
…es (#8514) (#8552) * Update db search and replace API to allow replacements on working copies * Remove param * retrigger checks * retrigger checks * Update db search and replace preview API to allow replacements on working copies * Update search and replace logic to use the correct repository * Remove unused import * Update selectOneWithSearchAndReplace to fallback to non-draft repository * Fix calling wrong method Co-authored-by: tylerjmchugh <[email protected]>
Currently the db search and replace API does not support working copies. This means that when we try to create a working copy and apply the search and replace on it, the working copy is ignored and the change is applied directly to the approved version.
This PR aims to fix this by implementing the following logic:
Checklist
main
branch, backports managed with labelREADME.md
filespom.xml
dependency management. Update build documentation with intended library use and library tutorials or documentation