Skip to content

Commit

Permalink
merge OpenSSH and gerrit PRs
Browse files Browse the repository at this point in the history
This merges PR martinvonz#3191 (OpenSSH) and PR martinvonz#2845 (Gerrit) in order to build
from the combination.
  • Loading branch information
lilyball committed Oct 19, 2024
3 parents 49e9003 + 1d7aaa6 + 11ed301 commit 0f66bb1
Show file tree
Hide file tree
Showing 13 changed files with 704 additions and 28 deletions.
23 changes: 4 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ dunce = "1.0.5"
either = "1.13.0"
esl01-renderdag = "0.3.0"
futures = "0.3.31"
git2 = { version = "0.19.0", features = [
git2 = { git = "https://github.com/bnjmnt4n/git2-rs.git", rev = "60e29ff0d", default-features = false, features = [
"https",
"ssh-openssh",
# Do *not* disable this feature even if you'd like dynamic linking. Instead,
# set the environment variable `LIBGIT2_NO_VENDOR=1` if dynamic linking must
# be used (this will override the Cargo feature), and allow static linking
Expand Down Expand Up @@ -140,7 +142,7 @@ implicit_clone = "warn"
needless_for_each = "warn"
semicolon_if_nothing_returned = "warn"
uninlined_format_args = "warn"

# Insta suggests compiling these packages in opt mode for faster testing.
# See https://docs.rs/insta/latest/insta/#optional-faster-runs.
[profile.dev.package]
Expand Down
4 changes: 3 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include = [
"/tests/",
"!*.pending-snap",
"!*.snap*",
"/tests/[email protected]"
"/tests/[email protected]",
]

[[bin]]
Expand Down Expand Up @@ -64,6 +64,7 @@ esl01-renderdag = { workspace = true }
futures = { workspace = true }
git2 = { workspace = true }
gix = { workspace = true }
hex = { workspace = true }
indexmap = { workspace = true }
indoc = { workspace = true }
itertools = { workspace = true }
Expand All @@ -74,6 +75,7 @@ once_cell = { workspace = true }
pest = { workspace = true }
pest_derive = { workspace = true }
pollster = { workspace = true }
rand = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
rpassword = { workspace = true }
Expand Down
57 changes: 57 additions & 0 deletions cli/src/commands/gerrit/mod.rs
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;
Loading

0 comments on commit 0f66bb1

Please sign in to comment.