-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add patch series support to show & int cmds
Add patch series support to the show & integrate commands so that users would be able to show & integrate an individual patch or a patch series. As part of this I also added a new hook to integrate that gets when not using the --force switch. It is called `integrate_verify` the intent with it is that you could use it to check the status of a PR from a remote systems like GitHub to prevent you from integrating. This might be useful to check the CI status of a PR or Approval status of a PR for example. Supporting patch series for the show command was pretty straight forward. However, the integrate command was another thing. The way we had it implemented previously wasn't very clear what the distinction between --force and non-force were. Also all of the checks in the non-force were previosly written explicitly as if there was one patch and not a series. So, I effectively restructured and rewrote the entire thing. A few things that I determined while designing this. Similiar with all the other commands the user should have to think as little as possible about the concept of branches and focus primarily on the concept of patches. In this context this primarily means that the state of the patches in patch stack is what should be integrated into the upstream. So, I decided that we always want to create/replace the request review branch so that it has the most recent state from the patch stack prior to the actual push. This is different from the previous implementation where it only did this when the --force switch was present. I also decided that --force effectively means to skip the safety checks that make sure the patches in the patch stack match the patches in the remote branch prior to create/replace the request review branch. This is different than the previous implementation as in the previous implementation the create/replace the request review branch would only happen if the --force switch was passed. The following is an outline of how integrate should conceptually be working now. - validate patch indexes are within bounds - add patch ids - prompt_for_reassurance (based on config) - git fetch - update the knowledge of the remotes - if NOT force - figure out associated branch - verify has associated branch, exit with error - check to make sure patches match between stack & remote - TODO: in the future: execute hook to verify PR approval & CI status - create/replace the request review branch - in fresh case, it creates the branch, in existing case it updates it to the latest state from ps - verify isolation (verifies cherry-pick cleanly but also verify isolation hook passes) - publish the patch(es) from local patch branch up to patch stack upstream - execute integrate post push hook - optionally (based on config) delete remote if exists request review branch - optionally (based on config) delete local request review branch - optionnaly pull (based on config) [changelog] added: patch series support to the show command added: patch series support to the integrate command added: integrate_verify hook to the integrate command <!-- ps-id: 09ca28df-b891-41c0-b36b-aedf30f4b83a -->
- Loading branch information
1 parent
ea3ab90
commit 811dddb
Showing
10 changed files
with
574 additions
and
578 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
use super::patch_index_range::PatchIndexRange; | ||
use gps as ps; | ||
use std::str::FromStr; | ||
|
||
pub fn show(patch_index: usize) { | ||
match ps::show(patch_index) { | ||
Ok(_) => (), | ||
pub fn show(patch_index_or_range: String) { | ||
match PatchIndexRange::from_str(&patch_index_or_range) { | ||
Ok(patch_index_range) => { | ||
match ps::show(patch_index_range.start_index, patch_index_range.end_index) { | ||
Ok(_) => (), | ||
Err(e) => { | ||
eprintln!("Error: {:?}", e); | ||
std::process::exit(1); | ||
} | ||
}; | ||
} | ||
Err(e) => { | ||
eprintln!("Error: {:?}", e); | ||
std::process::exit(1); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.