-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: create ref from commit id #262
Conversation
crud/src/main/java/org/openmbee/mms/crud/services/DefaultBranchService.java
Dismissed
Show dismissed
Hide dismissed
b.setParentCommit(parent.getId()); | ||
branch.setParentCommitId(parent.getCommitId()); | ||
}); | ||
}, |
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.
This method was updated so that if a RefJson has a parentCommitId, we don't set the new branch's parentCommitId to the the latest from the parent ref.
i would suggest leaving the current crud test collection as is and make a new collection just for testing elements at commit, otherwise crud gets increasingly hard to follow on what element is supposed to be where - I think I'll just make a new collection as part of #261, then this can add to that collection by branching from the tests for getElements at commitId |
for (Node node : nodes) { | ||
if(nodeCommitData.containsKey(node.getNodeId())){ | ||
node.setDocId(nodeCommitData.get(node.getNodeId()).getDocId()); | ||
node.setDeleted(false); |
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.
also set node lastCommitId to be the element json's commitId
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.
need to do what line 189 is doing also - and not do line 189 if it wasn't branch from latest
example/crud.postman_collection.json
Outdated
" var jsonData = pm.response.json();", | ||
" pm.expect(jsonData.commitId).to.eql(pm.environment.get(\"commitXYRef\"))", | ||
"", | ||
" pm.environment.set(\"commitXYRefElements\", pm.response.json());", |
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.
using the entire json here to compare with later won't work since the return elements' _refId should reflect the context they're gotten in - getting the elements from a branch will have slightly different json even if they're the same elements (the _refId will be different)
# Conflicts: # crud/src/main/java/org/openmbee/mms/crud/services/NodeGetHelper.java
Set<String> docIds = new HashSet<>(); | ||
for (Node n: nodeRepository.findAllByDeleted(false)) { | ||
docIds.add(n.getDocId()); | ||
if(branch.getParentCommitId() == null) { |
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.
the parent commitId would never be null here since it's set at line 172, should add a boolean to keep track above
nodeRepository.updateAll(nodes); | ||
|
||
Set<String> docIds = new HashSet<>(); | ||
for (Node n: nodeRepository.findAllByDeleted(false)) { |
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.
you can add to docIds as you're looping through the nodes so you don't have to call nodeRepository again
Quality Gate failedFailed conditions |
Thank you for the feedback @dlamoris. I've gone ahead and committed my changes. |
What changed?
Added functionality to be able to make a ref from a commit.
While developing this feature I identified #261. I've added a test case for checking elements at a specific commit, as well as checking elements made under a branch created from a commit. Both of these tests are currently failing. Fixing #261 should resolve both of these tests.
With this feature, you'll be able to create a ref from a commit like this:
Fixes #237