httpd: Add `patch::Action::Lifecycle`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
parent
c9aaaec2ee
commit
8907ddb8a5
|
|
@ -645,6 +645,9 @@ async fn patch_update_handler(
|
||||||
patch::Action::Redact { .. } => {
|
patch::Action::Redact { .. } => {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
patch::Action::Lifecycle { state } => {
|
||||||
|
patch.lifecycle(state, &signer)?;
|
||||||
|
}
|
||||||
patch::Action::Review {
|
patch::Action::Review {
|
||||||
revision,
|
revision,
|
||||||
comment,
|
comment,
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,9 @@ pub enum Action {
|
||||||
base: git::Oid,
|
base: git::Oid,
|
||||||
oid: git::Oid,
|
oid: git::Oid,
|
||||||
},
|
},
|
||||||
|
Lifecycle {
|
||||||
|
state: State,
|
||||||
|
},
|
||||||
Redact {
|
Redact {
|
||||||
revision: RevisionId,
|
revision: RevisionId,
|
||||||
},
|
},
|
||||||
|
|
@ -269,6 +272,9 @@ impl store::FromHistory for Patch {
|
||||||
self.description.set(description, op.clock);
|
self.description.set(description, op.clock);
|
||||||
self.target.set(target, op.clock);
|
self.target.set(target, op.clock);
|
||||||
}
|
}
|
||||||
|
Action::Lifecycle { state } => {
|
||||||
|
self.state.set(state, op.clock);
|
||||||
|
}
|
||||||
Action::Tag { add, remove } => {
|
Action::Tag { add, remove } => {
|
||||||
for tag in add {
|
for tag in add {
|
||||||
self.tags.insert(tag, op.clock);
|
self.tags.insert(tag, op.clock);
|
||||||
|
|
@ -697,6 +703,11 @@ impl store::Transaction<Patch> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Lifecycle a patch.
|
||||||
|
pub fn lifecycle(&mut self, state: State) -> Result<(), store::Error> {
|
||||||
|
self.push(Action::Lifecycle { state })
|
||||||
|
}
|
||||||
|
|
||||||
/// Tag a patch.
|
/// Tag a patch.
|
||||||
pub fn tag(
|
pub fn tag(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
@ -839,6 +850,11 @@ impl<'a, 'g> PatchMut<'a, 'g> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Lifecycle a patch.
|
||||||
|
pub fn lifecycle<G: Signer>(&mut self, state: State, signer: &G) -> Result<EntryId, Error> {
|
||||||
|
self.transaction("Lifecycle", signer, |tx| tx.lifecycle(state))
|
||||||
|
}
|
||||||
|
|
||||||
/// Tag a patch.
|
/// Tag a patch.
|
||||||
pub fn tag<G: Signer>(
|
pub fn tag<G: Signer>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue