Skip to content
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

[2/7] docs(submit): Adjust some messaging to be more forge-agnostic #1354

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions git-branchless-opts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,12 @@ pub struct SmartlogArgs {
/// The Git hosting provider to use, called a "forge".
#[derive(Clone, Debug, ValueEnum)]
pub enum ForgeKind {
/// Force-push branches to the default push remote.
/// Force-push branches to the default push remote. You can configure the
/// default push remote with `git config remote.pushDefault <remote>`.
Branch,

/// Force-push branches to the remote and create a pull request for each
/// branch using the `gh` command-line tool.
/// branch using the `gh` command-line tool. WARNING: likely buggy!
Github,

/// Submit code reviews to Phabricator using the `arc` command-line tool.
Expand All @@ -375,42 +376,45 @@ pub enum ForgeKind {
/// Push commits to a remote.
#[derive(Debug, Parser)]
pub struct SubmitArgs {
/// If there is no remote branch for a given local branch, create the
/// remote branch by pushing the local branch to the default push
/// remote.
///
/// You can configure the default push remote with `git config
/// remote.pushDefault <remote>`.
#[clap(action, short = 'c', long = "create")]
pub create: bool,

/// If the remote supports it, create code reviews in "draft" mode.
#[clap(action, short = 'd', long = "draft")]
pub draft: bool,

/// What kind of execution strategy to use for tools which need access to the working copy.
#[clap(short = 's', long = "strategy")]
pub strategy: Option<TestExecutionStrategy>,

/// The commits to push. All branches attached to those commits will be
/// pushed.
/// The commits to push to the forge. Unless `--create` is passed, this will
/// only push commits that already have associated remote objects on the
/// forge.
#[clap(value_parser, default_value = "stack()")]
pub revsets: Vec<Revset>,

/// Options for resolving revset expressions.
#[clap(flatten)]
pub resolve_revset_options: ResolveRevsetOptions,

/// The Git hosting provider to use.
/// The Git hosting provider to use, called a "forge". If not provided, an
/// attempt will be made to automatically detect the forge used by the
/// repository. If no forge can be detected, will fall back to the "branch"
/// forge.
#[clap(short = 'F', long = "forge")]
pub forge: Option<ForgeKind>,
pub forge_kind: Option<ForgeKind>,

/// An optional message to include with the create or update operation.
/// If there is no associated remote commit or code review object for a
/// given local commit, create the remote object by pushing the local commit
/// to the forge.
#[clap(action, short = 'c', long = "create")]
pub create: bool,

/// If the forge supports it, create code reviews in "draft" mode.
#[clap(action, short = 'd', long = "draft")]
pub draft: bool,

/// If the forge supports it, an optional message to include with the create
/// or update operation.
#[clap(short = 'm', long = "message")]
pub message: Option<String>,

/// If the forge supports it and uses a tool that needs access to the
/// working copy, what kind of execution strategy to use.
#[clap(short = 's', long = "strategy")]
pub execution_strategy: Option<TestExecutionStrategy>,

/// Don't push or create anything. Instead, report what would be pushed or
/// created. (Still triggers a fetch.)
/// created. (This may still trigger fetching information from the forge.)
#[clap(short = 'n', long = "dry-run")]
pub dry_run: bool,
}
Expand Down
16 changes: 8 additions & 8 deletions git-branchless-submit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,25 @@ pub fn command_main(ctx: CommandContext, args: SubmitArgs) -> EyreExitOr<()> {
git_run_info,
} = ctx;
let SubmitArgs {
create,
draft,
strategy,
revsets,
resolve_revset_options,
forge,
forge_kind,
create,
draft,
message,
execution_strategy,
dry_run,
} = args;
submit(
&effects,
&git_run_info,
revsets,
&resolve_revset_options,
forge_kind,
create,
draft,
strategy,
forge,
message,
execution_strategy,
dry_run,
)
}
Expand All @@ -214,11 +214,11 @@ fn submit(
git_run_info: &GitRunInfo,
revsets: Vec<Revset>,
resolve_revset_options: &ResolveRevsetOptions,
forge_kind: Option<ForgeKind>,
create: bool,
draft: bool,
execution_strategy: Option<TestExecutionStrategy>,
forge_kind: Option<ForgeKind>,
message: Option<String>,
execution_strategy: Option<TestExecutionStrategy>,
dry_run: bool,
) -> EyreExitOr<()> {
let repo = Repo::from_current_dir()?;
Expand Down
11 changes: 9 additions & 2 deletions git-branchless-submit/src/phabricator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl Forge for PhabricatorForge<'_> {
.map_err(|err| Error::VerifyPermissions { source: err })?
.map_err(Error::BuildRebasePlan)?;
let command = if !should_mock() {
let mut args = vec!["arc", "diff", "--create", "--verbatim"];
let mut args = vec!["arc", "diff", "--create", "--verbatim", "--allow-untracked"];
if *draft {
args.push("--draft");
}
Expand Down Expand Up @@ -614,7 +614,14 @@ Differential Revision: https://phabricator.example.com/D000$(git rev-list --coun
.map_err(Error::BuildRebasePlan)?;
let test_options = ResolvedTestOptions {
command: if !should_mock() {
let mut args = vec!["arc", "diff", "--head", "HEAD", "HEAD^"];
let mut args = vec![
"arc",
"diff",
"--head",
"HEAD",
"HEAD^",
"--allow-untracked",
];
args.extend(match message {
Some(message) => ["-m", message.as_ref()],
None => ["-m", "update"],
Expand Down
Loading