mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
V2
This commit is contained in:
@@ -194,10 +194,10 @@ impl PatchUndoHistory {
|
||||
}
|
||||
|
||||
fn finish_undo(&mut self, success: bool) {
|
||||
if let Some(turn) = self.undo_in_progress.take() {
|
||||
if !success {
|
||||
self.completed_turns.push(turn);
|
||||
}
|
||||
if let Some(turn) = self.undo_in_progress.take()
|
||||
&& !success
|
||||
{
|
||||
self.completed_turns.push(turn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1186,32 +1186,30 @@ pub(crate) fn new_patch_undo_available(patch_count: usize) -> PlainHistoryCell {
|
||||
}
|
||||
|
||||
pub(crate) fn new_patch_undo_unavailable() -> PlainHistoryCell {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
lines.push("No applied patch to undo.".dim().into());
|
||||
let lines = vec!["No applied patch to undo.".dim().into()];
|
||||
PlainHistoryCell { lines }
|
||||
}
|
||||
|
||||
pub(crate) fn new_patch_undo_busy() -> PlainHistoryCell {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
lines.push("Undo already running".magenta().bold().into());
|
||||
lines.push(
|
||||
let lines = vec![
|
||||
"Undo already running".magenta().bold().into(),
|
||||
"Wait for the previous undo to finish before starting another."
|
||||
.dim()
|
||||
.into(),
|
||||
);
|
||||
];
|
||||
PlainHistoryCell { lines }
|
||||
}
|
||||
|
||||
pub(crate) fn new_patch_undo_in_progress() -> PlainHistoryCell {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
lines.push("↺ Undoing latest patch…".magenta().bold().into());
|
||||
let lines = vec!["↺ Undoing latest patch…".magenta().bold().into()];
|
||||
PlainHistoryCell { lines }
|
||||
}
|
||||
|
||||
pub(crate) fn new_patch_undo_cancelled() -> PlainHistoryCell {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
lines.push("↺ Undo cancelled".magenta().bold().into());
|
||||
lines.push("Keeping the last turn's changes.".dim().into());
|
||||
let lines = vec![
|
||||
"↺ Undo cancelled".magenta().bold().into(),
|
||||
"Keeping the last turn's changes.".dim().into(),
|
||||
];
|
||||
PlainHistoryCell { lines }
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +61,9 @@ mod tests {
|
||||
if status.success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("git {:?} failed with status {status}", args),
|
||||
))
|
||||
Err(io::Error::other(format!(
|
||||
"git {args:?} failed with status {status}"
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,14 +72,11 @@ mod tests {
|
||||
if output.status.success() {
|
||||
Ok(String::from_utf8_lossy(&output.stdout).into_owned())
|
||||
} else {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!(
|
||||
"git {:?} failed: {}",
|
||||
args,
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
),
|
||||
))
|
||||
Err(io::Error::other(format!(
|
||||
"git {:?} failed: {}",
|
||||
args,
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user