Skip to content

Commit ff9d10a

Browse files
committed
docs(submit): Adjust some messaging to be more forge-agnostic
1 parent 451ae8d commit ff9d10a

File tree

2 files changed

+37
-33
lines changed
  • git-branchless-opts/src
  • git-branchless-submit/src

2 files changed

+37
-33
lines changed

git-branchless-opts/src/lib.rs

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,12 @@ pub struct SmartlogArgs {
361361
/// The Git hosting provider to use, called a "forge".
362362
#[derive(Clone, Debug, ValueEnum)]
363363
pub enum ForgeKind {
364-
/// Force-push branches to the default push remote.
364+
/// Force-push branches to the default push remote. You can configure the
365+
/// default push remote with `git config remote.pushDefault <remote>`.
365366
Branch,
366367

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

371372
/// Submit code reviews to Phabricator using the `arc` command-line tool.
@@ -375,42 +376,45 @@ pub enum ForgeKind {
375376
/// Push commits to a remote.
376377
#[derive(Debug, Parser)]
377378
pub struct SubmitArgs {
378-
/// If there is no remote branch for a given local branch, create the
379-
/// remote branch by pushing the local branch to the default push
380-
/// remote.
381-
///
382-
/// You can configure the default push remote with `git config
383-
/// remote.pushDefault <remote>`.
384-
#[clap(action, short = 'c', long = "create")]
385-
pub create: bool,
386-
387-
/// If the remote supports it, create code reviews in "draft" mode.
388-
#[clap(action, short = 'd', long = "draft")]
389-
pub draft: bool,
390-
391-
/// What kind of execution strategy to use for tools which need access to the working copy.
392-
#[clap(short = 's', long = "strategy")]
393-
pub strategy: Option<TestExecutionStrategy>,
394-
395-
/// The commits to push. All branches attached to those commits will be
396-
/// pushed.
379+
/// The commits to push to the forge. Unless `--create` is passed, this will
380+
/// only push commits that already have associated remote objects on the
381+
/// forge.
397382
#[clap(value_parser, default_value = "stack()")]
398383
pub revsets: Vec<Revset>,
399384

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

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

408-
/// An optional message to include with the create or update operation.
396+
/// If there is no associated remote commit or code review object for a
397+
/// given local commit, create the remote object by pushing the local commit
398+
/// to the forge.
399+
#[clap(action, short = 'c', long = "create")]
400+
pub create: bool,
401+
402+
/// If the forge supports it, create code reviews in "draft" mode.
403+
#[clap(action, short = 'd', long = "draft")]
404+
pub draft: bool,
405+
406+
/// If the forge supports it, an optional message to include with the create
407+
/// or update operation.
409408
#[clap(short = 'm', long = "message")]
410409
pub message: Option<String>,
411410

411+
/// If the forge supports it and uses a tool that needs access to the
412+
/// working copy, what kind of execution strategy to use.
413+
#[clap(short = 's', long = "strategy")]
414+
pub execution_strategy: Option<TestExecutionStrategy>,
415+
412416
/// Don't push or create anything. Instead, report what would be pushed or
413-
/// created. (Still triggers a fetch.)
417+
/// created. (This may still trigger fetching information from the forge.)
414418
#[clap(short = 'n', long = "dry-run")]
415419
pub dry_run: bool,
416420
}

git-branchless-submit/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,25 +186,25 @@ pub fn command_main(ctx: CommandContext, args: SubmitArgs) -> EyreExitOr<()> {
186186
git_run_info,
187187
} = ctx;
188188
let SubmitArgs {
189-
create,
190-
draft,
191-
strategy,
192189
revsets,
193190
resolve_revset_options,
194-
forge,
191+
forge_kind,
192+
create,
193+
draft,
195194
message,
195+
execution_strategy,
196196
dry_run,
197197
} = args;
198198
submit(
199199
&effects,
200200
&git_run_info,
201201
revsets,
202202
&resolve_revset_options,
203+
forge_kind,
203204
create,
204205
draft,
205-
strategy,
206-
forge,
207206
message,
207+
execution_strategy,
208208
dry_run,
209209
)
210210
}
@@ -214,11 +214,11 @@ fn submit(
214214
git_run_info: &GitRunInfo,
215215
revsets: Vec<Revset>,
216216
resolve_revset_options: &ResolveRevsetOptions,
217+
forge_kind: Option<ForgeKind>,
217218
create: bool,
218219
draft: bool,
219-
execution_strategy: Option<TestExecutionStrategy>,
220-
forge_kind: Option<ForgeKind>,
221220
message: Option<String>,
221+
execution_strategy: Option<TestExecutionStrategy>,
222222
dry_run: bool,
223223
) -> EyreExitOr<()> {
224224
let repo = Repo::from_current_dir()?;

0 commit comments

Comments
 (0)