Skip to content
Open
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
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,22 @@ origin annotate @ review --withdraw -m "Spoke too soon" # take your statement
origin annotate --on <id> flaky --neutral -m "Timeout on CI" # a statement about a statement
origin statements [<rev>] # the statements about a revision, and those about them
origin promote [<rev>] # carry results over from revisions with the same inputs

origin land [<change>] [--onto <target>] # land a change and the ones below it
origin land --from <target> --onto <target> # land a target's tip on another
origin land --status # the landings waiting for evidence or a conflict fix
origin targets # every target, its tip, authority and requirements
origin target new <name> --from <target>
origin new [description] --on <target> # start a change on a target's tip
```

Landing rebases a change onto the target's tip, file by file, checks the
statements `policy.toml` requires (promoting results whose inputs didn't
change), and appends an acceptance signed by your node, which must be the
target's authority. A landing that conflicts or lacks evidence waits: issue
the statements, or a new revision, and run `origin land` again. Policy is a
target too: edit it with `origin new --on policy`, then `origin land`.

Changes are named by a unique prefix of their id, or `@` for the working
copy's. A revision is `@`, a change (for its head), or a unique prefix of
the revision's id. Your name and node key live in `$ORIGIN_CONFIG_DIR`, or
Expand All @@ -44,8 +58,9 @@ in its `config.toml` if `$USER` isn't the name you want. See
`converge` merges the files of a change's heads. A text file two heads
changed holds both versions between conflict markers (`<<<<<<<`, `=======`,
`>>>>>>>`), and a binary one keeps one side. A `core.conflict` statement
records which files conflict and what the merge wrote there, until they
change: edit them, or accept a file as it is with `origin resolve <path>`. `status` lists those left, and every new
records which files conflict and what the merge wrote there, and the change
doesn't land while they're unchanged: edit them, or accept a file as it is
with `origin resolve <path>`. `status` lists those left, and every new
revision, `describe` included, keeps them.

## Development
Expand Down
55 changes: 54 additions & 1 deletion apps/origin-src/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ enum WorkspaceCommand {
/// What the new change is for.
#[arg(default_value = "")]
description: String,
/// Start it on the tip of this target instead.
#[arg(long)]
on: Option<TargetName>,
},
/// Describe what the current change is for.
Describe {
Expand Down Expand Up @@ -125,6 +128,44 @@ enum WorkspaceCommand {
#[arg(default_value = "@")]
rev: String,
},
/// Land a change on a target, with the changes below it the target
/// doesn't have yet. The queue rebases it onto the target's tip, checks
/// the evidence `policy.toml` requires, and if it's there, appends a
/// signed acceptance. A landing that conflicts or lacks evidence waits.
Land(LandArgs),
/// Manage targets.
#[command(subcommand)]
Target(TargetCommand),
/// List the targets, with their tips, authorities and requirements.
Targets,
}

#[derive(Debug, Args)]
struct LandArgs {
/// The change: the working copy's by default.
#[arg(conflicts_with_all = ["from", "status"])]
change: Option<String>,
/// The target to land on: by default, the one the change is on.
#[arg(long)]
onto: Option<TargetName>,
/// Land the tip of this target instead of a change.
#[arg(long, requires = "onto")]
from: Option<TargetName>,
/// List the landings that wait, and why.
#[arg(long, conflicts_with_all = ["onto", "from"])]
status: bool,
}

#[derive(Debug, Subcommand)]
enum TargetCommand {
/// Create a target at the tip of another.
New {
/// Its name, such as `release/v3`.
name: TargetName,
/// The target it starts from.
#[arg(long)]
from: TargetName,
},
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -337,7 +378,10 @@ impl WorkspaceCommand {
Self::Status => workspace.status()?,
Self::Diff => workspace.diff()?,
Self::Show { change } => workspace.show(change.as_deref())?,
Self::New { description } => workspace.new_change(&description)?,
Self::New { description, on } => match on {
Some(target) => workspace.new_on(&target, &description)?,
None => workspace.new_change(&description)?,
},
Self::Describe { description } => workspace.describe(&description)?,
Self::Resolve { paths } => workspace.resolve(&paths)?,
Self::Edit { change } => workspace.edit(&change)?,
Expand All @@ -358,6 +402,15 @@ impl WorkspaceCommand {
}
Self::Statements { rev } => workspace.statements(&rev)?,
Self::Promote { rev } => workspace.promote(&rev)?,
Self::Land(args) => match (args.from, args.onto) {
_ if args.status => workspace.land_status()?,
(Some(from), Some(onto)) => workspace.land_target(&from, &onto)?,
(_, onto) => workspace.land(args.change.as_deref(), onto)?,
},
Self::Target(TargetCommand::New { name, from }) => {
workspace.target_new(&name, &from)?;
}
Self::Targets => workspace.targets()?,
}
Ok(())
}
Expand Down
Loading
Loading