-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: basic
jj gerrit send
implementation
This implements the most basic workflow for submitting changes to Gerrit, through a verb called 'send'. This verb is intended to be distinct from the word 'submit', which for Gerrit means 'merge a change into the repository.' Given a list of revsets (specified by multiple `-r` options), this will parse the footers of every commit, collect them, insert a `Change-Id` (if one doesn't already exist), and then push them into the given remote. Because the argument is a revset, you may submit entire trees of changes at once, including multiple trees of independent changes, e.g. jj gerrit send -r foo:: -r baz:: There are many other improvements that can be applied on top of this, including a ton of consistency and "does this make sense?" checks. However, it is flexible and a good starting point, and you can in fact both submit and cycle reviews with this interface. Signed-off-by: Austin Seipp <[email protected]>
- Loading branch information
1 parent
e2f076f
commit 3c2e0b0
Showing
7 changed files
with
540 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ include = [ | |
"/tests/", | ||
"!*.pending-snap", | ||
"!*.snap*", | ||
"/tests/[email protected]" | ||
"/tests/[email protected]", | ||
] | ||
|
||
[[bin]] | ||
|
@@ -70,6 +70,7 @@ once_cell = { workspace = true } | |
pest = { workspace = true } | ||
pest_derive = { workspace = true } | ||
pollster = { workspace = true } | ||
rand = { workspace = true } | ||
regex = { workspace = true } | ||
rpassword = { workspace = true } | ||
scm-record = { workspace = true } | ||
|
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2024 The Jujutsu Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use std::fmt::Debug; | ||
|
||
use clap::Subcommand; | ||
|
||
use crate::cli_util::CommandHelper; | ||
use crate::command_error::CommandError; | ||
use crate::commands::gerrit; | ||
use crate::ui::Ui; | ||
|
||
/// Interact with Gerrit Code Review. | ||
#[derive(Subcommand, Clone, Debug)] | ||
pub enum GerritCommand { | ||
/// Send changes to Gerrit for code review, or update existing changes. | ||
/// | ||
/// Sending in a set of revisions to Gerrit creates a single "change" for | ||
/// each revision included in the revset. This change is then available for | ||
/// review on your Gerrit instance. | ||
/// | ||
/// This command modifies each commit in the revset to include a `Change-Id` | ||
/// footer in its commit message if one does not already exist. Note that | ||
/// this ID is NOT compatible with jj IDs, and is Gerrit-specific. | ||
/// | ||
/// If a change already exists for a given revision (i.e. it contains the | ||
/// same `Change-Id`), this command will update the contents of the existing | ||
/// change to match. | ||
/// | ||
/// Note: this command takes 1-or-more revsets arguments, each of which can | ||
/// resolve to multiple revisions; so you may post trees or ranges of | ||
/// commits to Gerrit for review all at once. | ||
Send(gerrit::send::SendArgs), | ||
} | ||
|
||
pub fn cmd_gerrit( | ||
ui: &mut Ui, | ||
command: &CommandHelper, | ||
subcommand: &GerritCommand, | ||
) -> Result<(), CommandError> { | ||
match subcommand { | ||
GerritCommand::Send(review) => gerrit::send::cmd_send(ui, command, review), | ||
} | ||
} | ||
|
||
mod send; |
Oops, something went wrong.