Skip to content

Commit

Permalink
cli: refer to revset argument using REVSET(S) in synopsis
Browse files Browse the repository at this point in the history
This should help clarify that the arguments are not just simple change
ids or commit ids.
  • Loading branch information
martinvonz committed Dec 18, 2024
1 parent bf0faca commit 7f2ab4c
Show file tree
Hide file tree
Showing 44 changed files with 277 additions and 136 deletions.
6 changes: 5 additions & 1 deletion cli/src/commands/abandon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct AbandonArgs {
/// The revision(s) to abandon
#[arg(default_value = "@", add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(
default_value = "@",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revisions: Vec<RevisionArg>,
/// Do not print every abandoned commit on a separate line
#[arg(long, short)]
Expand Down
2 changes: 2 additions & 0 deletions cli/src/commands/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub(crate) struct AbsorbArgs {
#[arg(
long, short,
default_value = "@",
value_name="REVSET",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
from: RevisionArg,
Expand All @@ -48,6 +49,7 @@ pub(crate) struct AbsorbArgs {
#[arg(
long, short = 't', visible_alias = "to",
default_value = "mutable()",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
into: Vec<RevisionArg>,
Expand Down
2 changes: 2 additions & 0 deletions cli/src/commands/backout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub(crate) struct BackoutArgs {
#[arg(
long, short,
default_value = "@",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revisions: Vec<RevisionArg>,
Expand All @@ -40,6 +41,7 @@ pub(crate) struct BackoutArgs {
#[arg(
long, short,
default_value = "@",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
destination: Vec<RevisionArg>,
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/bookmark/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct BookmarkCreateArgs {
#[arg(
long, short,
visible_alias = "to",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revision: Option<RevisionArg>,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/bookmark/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub struct BookmarkListArgs {
///
/// Note that `-r deleted_bookmark` will not work since `deleted_bookmark`
/// wouldn't have a local target.
#[arg(long, short)]
#[arg(long, short, value_name = "REVSETS")]
revisions: Option<Vec<RevisionArg>>,

/// Render each bookmark using the given template
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/bookmark/move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub struct BookmarkMoveArgs {
#[arg(
long,
group = "source",
value_name = "REVISIONS",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
from: Vec<RevisionArg>,
Expand All @@ -60,7 +60,7 @@ pub struct BookmarkMoveArgs {
#[arg(
long,
default_value = "@",
value_name = "REVISION",
value_name = "REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
to: RevisionArg,
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/bookmark/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct BookmarkSetArgs {
#[arg(
long, short,
visible_alias = "to",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revision: Option<RevisionArg>,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/debug/copy_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub struct CopyDetectionArgs {
/// Show changes in this revision, compared to its parent(s)
#[arg(default_value = "@")]
#[arg(default_value = "@", value_name = "REVSET")]
revision: RevisionArg,
}

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/debug/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::ui::Ui;
/// List the recursive entries of a tree.
#[derive(clap::Args, Clone, Debug)]
pub struct DebugTreeArgs {
#[arg(long, short = 'r')]
#[arg(long, short = 'r', value_name = "REVSET")]
revision: Option<RevisionArg>,
#[arg(long, conflicts_with = "revision")]
id: Option<String>,
Expand Down
6 changes: 5 additions & 1 deletion cli/src/commands/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ use crate::ui::Ui;
#[command(visible_aliases = &["desc"])]
pub(crate) struct DescribeArgs {
/// The revision(s) whose description to edit
#[arg(default_value = "@", add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(
default_value = "@",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revisions: Vec<RevisionArg>,
/// Ignored (but lets you pass `-r` for consistency with other commands)
#[arg(short = 'r', hide = true, action = clap::ArgAction::Count)]
Expand Down
23 changes: 20 additions & 3 deletions cli/src/commands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,30 @@ pub(crate) struct DiffArgs {
/// If the revision is a merge commit, this shows changes *from* the
/// automatic merge of the contents of all of its parents *to* the contents
/// of the revision itself.
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
revision: Option<RevisionArg>,
/// Show changes from this revision
#[arg(long, short, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
conflicts_with = "revision",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
from: Option<RevisionArg>,
/// Show changes to this revision
#[arg(long, short, conflicts_with = "revision", add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
conflicts_with = "revision",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
to: Option<RevisionArg>,
/// Restrict the diff to these paths
#[arg(
Expand Down
9 changes: 8 additions & 1 deletion cli/src/commands/diffedit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ pub(crate) struct DiffeditArgs {
/// The revision to touch up
///
/// Defaults to @ if neither --to nor --from are specified.
#[arg(long, short, add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(
long,
short,
value_name="REVSET",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revision: Option<RevisionArg>,
/// Show changes from this revision
///
/// Defaults to @ if --to is specified.
#[arg(
long, short,
conflicts_with = "revision",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
from: Option<RevisionArg>,
Expand All @@ -67,6 +73,7 @@ pub(crate) struct DiffeditArgs {
#[arg(
long, short,
conflicts_with = "revision",
value_name="REVSET",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
to: Option<RevisionArg>,
Expand Down
16 changes: 13 additions & 3 deletions cli/src/commands/duplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,21 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct DuplicateArgs {
/// The revision(s) to duplicate (default: @)
#[arg(value_name = "REVISIONS", add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions)
)]
revisions_pos: Vec<RevisionArg>,
#[arg(short = 'r', hide = true)]
#[arg(short = 'r', hide = true, value_name = "REVSETS")]
revisions_opt: Vec<RevisionArg>,
/// The revision(s) to duplicate onto (can be repeated to create a merge
/// commit)
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions)
)]
destination: Vec<RevisionArg>,
/// The revision(s) to insert after (can be repeated to create a merge
/// commit)
Expand All @@ -67,6 +75,7 @@ pub(crate) struct DuplicateArgs {
short = 'A',
visible_alias = "after",
conflicts_with = "destination",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
insert_after: Vec<RevisionArg>,
Expand All @@ -77,6 +86,7 @@ pub(crate) struct DuplicateArgs {
short = 'B',
visible_alias = "before",
conflicts_with = "destination",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
insert_before: Vec<RevisionArg>,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct EditArgs {
/// The commit to edit
#[arg(add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(value_name="REVSET", add = ArgValueCandidates::new(complete::mutable_revisions))]
revision: RevisionArg,
/// Ignored (but lets you pass `-r` for consistency with other commands)
#[arg(short = 'r', hide = true)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/evolog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub(crate) struct EvologArgs {
#[arg(
long, short,
default_value = "@",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revision: RevisionArg,
Expand Down
7 changes: 6 additions & 1 deletion cli/src/commands/file/annotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ pub(crate) struct FileAnnotateArgs {
)]
path: String,
/// an optional revision to start at
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
revision: Option<RevisionArg>,
}

Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/chmod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub(crate) struct FileChmodArgs {
#[arg(
long, short,
default_value = "@",
value_name="REVSET",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
revision: RevisionArg,
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub(crate) struct FileListArgs {
#[arg(
long, short,
default_value = "@",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revision: RevisionArg,
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/file/show.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub(crate) struct FileShowArgs {
#[arg(
long, short,
default_value = "@",
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions),
)]
revision: RevisionArg,
Expand Down
7 changes: 6 additions & 1 deletion cli/src/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ pub(crate) struct FixArgs {
/// Fix files in the specified revision(s) and their descendants. If no
/// revisions are specified, this defaults to the `revsets.fix` setting, or
/// `reachable(@, mutable())` if it is not set.
#[arg(long, short, add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(
long,
short,
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
source: Vec<RevisionArg>,
/// Fix only these paths
#[arg(value_name = "FILESETS", value_hint = clap::ValueHint::AnyPath)]
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/git/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ pub struct GitPushArgs {
#[arg(long)]
allow_private: bool,
/// Push bookmarks pointing to these commits (can be repeated)
#[arg(long, short)]
#[arg(long, short, value_name = "REVSETS")]
revisions: Vec<RevisionArg>,
/// Push this commit by creating a bookmark based on its change ID (can be
/// repeated)
///
/// The created bookmark will be tracked automatically. Use the
/// `git.push-bookmark-prefix` setting to change the prefix for generated
/// names.
#[arg(long, short)]
#[arg(long, short, value_name = "REVSETS")]
change: Vec<RevisionArg>,
/// Only display what will change on the remote
#[arg(long)]
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/git/submodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn cmd_git_submodule(
#[command(hide = true)]
pub struct PrintArgs {
/// Read .gitmodules from the given revision.
#[arg(long, short = 'r', default_value = "@")]
#[arg(long, short = 'r', default_value = "@", value_name="REVSET")]
revisions: RevisionArg,
}

Expand Down
14 changes: 12 additions & 2 deletions cli/src/commands/interdiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,20 @@ use crate::ui::Ui;
#[command(mut_arg("ignore_space_change", |a| a.short('b')))]
pub(crate) struct InterdiffArgs {
/// Show changes from this revision
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
from: Option<RevisionArg>,
/// Show changes to this revision
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name="REVSET",
add = ArgValueCandidates::new(complete::all_revisions)
)]
to: Option<RevisionArg>,
/// Restrict the diff to these paths
#[arg(
Expand Down
7 changes: 6 additions & 1 deletion cli/src/commands/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ pub(crate) struct LogArgs {
///
/// If no paths nor revisions are specified, this defaults to the
/// `revsets.log` setting.
#[arg(long, short, add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
long,
short,
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions)
)]
revisions: Vec<RevisionArg>,
/// Show revisions modifying the given paths
#[arg(
Expand Down
8 changes: 7 additions & 1 deletion cli/src/commands/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct NewArgs {
/// Parent(s) of the new change
#[arg(default_value = "@", add = ArgValueCandidates::new(complete::all_revisions))]
#[arg(
default_value = "@",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions)
)]
pub(crate) revisions: Vec<RevisionArg>,
/// Ignored (but lets you pass `-d`/`-r` for consistency with other
/// commands)
Expand All @@ -73,6 +77,7 @@ pub(crate) struct NewArgs {
short = 'A',
visible_alias = "after",
conflicts_with = "revisions",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
insert_after: Vec<RevisionArg>,
Expand All @@ -82,6 +87,7 @@ pub(crate) struct NewArgs {
short = 'B',
visible_alias = "before",
conflicts_with = "revisions",
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
insert_before: Vec<RevisionArg>,
Expand Down
5 changes: 4 additions & 1 deletion cli/src/commands/parallelize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ use crate::ui::Ui;
#[command(verbatim_doc_comment)]
pub(crate) struct ParallelizeArgs {
/// Revisions to parallelize
#[arg(add = ArgValueCandidates::new(complete::mutable_revisions))]
#[arg(
value_name = "REVSETS",
add = ArgValueCandidates::new(complete::mutable_revisions)
)]
revisions: Vec<RevisionArg>,
}

Expand Down
Loading

0 comments on commit 7f2ab4c

Please sign in to comment.