Skip to content

Commit

Permalink
completion: teach absorb and bookmark move about revisions
Browse files Browse the repository at this point in the history
These were simply forgotten in dd6479f
  • Loading branch information
senekor committed Dec 3, 2024
1 parent 4e125b6 commit a9d4886
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions cli/src/commands/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::ops::Range;
use std::rc::Rc;

use bstr::BString;
use clap_complete::ArgValueCandidates;
use futures::StreamExt as _;
use itertools::Itertools as _;
use jj_lib::annotate::get_annotation_with_file_content;
Expand Down Expand Up @@ -49,6 +50,7 @@ use tracing::instrument;
use crate::cli_util::CommandHelper;
use crate::cli_util::RevisionArg;
use crate::command_error::CommandError;
use crate::complete;
use crate::ui::Ui;

/// Move changes from a revision into the stack of mutable revisions
Expand All @@ -62,12 +64,20 @@ use crate::ui::Ui;
#[derive(clap::Args, Clone, Debug)]
pub(crate) struct AbsorbArgs {
/// Source revision to absorb from
#[arg(long, short, default_value = "@")]
#[arg(
long, short,
default_value = "@",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
from: RevisionArg,
/// Destination revisions to absorb into
///
/// Only ancestors of the source revision will be considered.
#[arg(long, short = 't', visible_alias = "to", default_value = "mutable()")]
#[arg(
long, short = 't', visible_alias = "to",
default_value = "mutable()",
add = ArgValueCandidates::new(complete::mutable_revisions),
)]
into: Vec<RevisionArg>,
/// Move only changes to these paths (instead of all paths)
#[arg(value_hint = clap::ValueHint::AnyPath)]
Expand Down
14 changes: 12 additions & 2 deletions cli/src/commands/bookmark/move.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ pub struct BookmarkMoveArgs {
// We intentionally do not support the short `-f` for `--from` since it
// could be confused with a shorthand for `--force`, and people might not
// realize they need `-B`/`--allow-backwards` instead.
#[arg(long, group = "source", value_name = "REVISIONS")]
#[arg(
long,
group = "source",
value_name = "REVISIONS",
add = ArgValueCandidates::new(complete::all_revisions),
)]
from: Vec<RevisionArg>,

/// Move bookmarks to this revision
// We intentionally do not support the short `-t` for `--to` since we don't
// support `-f` for `--from`.
#[arg(long, default_value = "@", value_name = "REVISION")]
#[arg(
long,
default_value = "@",
value_name = "REVISION",
add = ArgValueCandidates::new(complete::all_revisions),
)]
to: RevisionArg,

/// Allow moving bookmarks backwards or sideways
Expand Down

0 comments on commit a9d4886

Please sign in to comment.