-
Notifications
You must be signed in to change notification settings - Fork 83
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
2400: Avoid overwriting mbox archive #1696
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back zsong! A progress list of the required criteria for merging this PR into |
@zhaosongzs This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. 🔍 One or more changes in this pull request modifies files in areas of the source code that often require two reviewers. Please consider if this is the case for this pull request, and if so, await a second reviewer to approve this pull request before you integrate it. 🌎 Applicable reviewers for one or more changes in this pull request are spread across multiple different time zones. Please consider waiting with integrating this pull request until it has been out for review for at least 24 hours to give all reviewers a chance to review the pull request. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
@@ -108,7 +108,7 @@ PullRequest createPullRequest(HostedRepository target, | |||
* @param authorName Name of author and committer for commit | |||
* @param authorEmail Email of author and committer for commit | |||
*/ | |||
void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail); | |||
void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail, boolean createNewFile); |
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.
Please update the javadoc with the new parameter and make it clear what should happen when set to true or false. If set to true, the call will fail if the file exists. If set to false, the call will fail if the file does not exist.
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.
Will do
@@ -291,7 +291,7 @@ public Optional<String> fileContents(String filename, String ref) { | |||
} | |||
|
|||
@Override | |||
public void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail) { | |||
public void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail, boolean createNewEmail) { |
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 variable name doesn't make sense here.
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.
Thanks for catching it! I was in a hurry when working on it
@@ -229,7 +229,7 @@ public Optional<String> fileContents(String filename, String ref) { | |||
} | |||
|
|||
@Override | |||
public void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail) { | |||
public void writeFileContents(String filename, String content, Branch branch, String message, String authorName, String authorEmail, boolean createNewFile) { |
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 implementation should also enforce the new behavior so we catch any mistakes in testing.
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.
Will fix it
Sometimes, the ArchiveWorkItem fails to retrieve the current contents of an mbox file while processing a PR. When this happens, it will resend all emails. Erik pointed out that in GitLab, creating a new file uses a POST request, while updating an existing file uses PUT. Similarly, GitHub requires the current "SHA" to update a file.
The ArchiveWorkItem can determine whether it found existing content in the mbox archive and choose the right method accordingly. If it incorrectly fails to retrieve the existing content from GitLab or GitHub, it will attempt to create a new file. This attempt should fail, triggering a retry of the WorkItem, which would ideally succeed in retrieving the existing content.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/skara.git pull/1696/head:pull/1696
$ git checkout pull/1696
Update a local copy of the PR:
$ git checkout pull/1696
$ git pull https://git.openjdk.org/skara.git pull/1696/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1696
View PR using the GUI difftool:
$ git pr show -t 1696
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/skara/pull/1696.diff
Using Webrev
Link to Webrev Comment