agent checkpoint dbgs
This commit is contained in:
parent
52a9101970
commit
b38b6ff12c
2 changed files with 22 additions and 2 deletions
|
@ -813,6 +813,7 @@ impl Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finalize_pending_checkpoint(&mut self, cx: &mut Context<Self>) {
|
fn finalize_pending_checkpoint(&mut self, cx: &mut Context<Self>) {
|
||||||
|
dbg!("finalize_pending_checkpoint");
|
||||||
let pending_checkpoint = if self.is_generating() {
|
let pending_checkpoint = if self.is_generating() {
|
||||||
return;
|
return;
|
||||||
} else if let Some(checkpoint) = self.pending_checkpoint.take() {
|
} else if let Some(checkpoint) = self.pending_checkpoint.take() {
|
||||||
|
@ -829,10 +830,13 @@ impl Thread {
|
||||||
pending_checkpoint: ThreadCheckpoint,
|
pending_checkpoint: ThreadCheckpoint,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
|
dbg!("finalize_checkpoint");
|
||||||
let git_store = self.project.read(cx).git_store().clone();
|
let git_store = self.project.read(cx).git_store().clone();
|
||||||
let final_checkpoint = git_store.update(cx, |git_store, cx| git_store.checkpoint(cx));
|
let final_checkpoint = git_store.update(cx, |git_store, cx| git_store.checkpoint(cx));
|
||||||
cx.spawn(async move |this, cx| match final_checkpoint.await {
|
cx.spawn(async move |this, cx| match final_checkpoint.await {
|
||||||
Ok(final_checkpoint) => {
|
Ok(final_checkpoint) => {
|
||||||
|
dbg!(&pending_checkpoint.git_checkpoint);
|
||||||
|
dbg!(&final_checkpoint);
|
||||||
let equal = git_store
|
let equal = git_store
|
||||||
.update(cx, |store, cx| {
|
.update(cx, |store, cx| {
|
||||||
store.compare_checkpoints(
|
store.compare_checkpoints(
|
||||||
|
@ -844,7 +848,7 @@ impl Thread {
|
||||||
.await
|
.await
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
if !equal {
|
if dbg!(!equal) {
|
||||||
this.update(cx, |this, cx| {
|
this.update(cx, |this, cx| {
|
||||||
this.insert_checkpoint(pending_checkpoint, cx)
|
this.insert_checkpoint(pending_checkpoint, cx)
|
||||||
})?;
|
})?;
|
||||||
|
@ -860,6 +864,7 @@ impl Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_checkpoint(&mut self, checkpoint: ThreadCheckpoint, cx: &mut Context<Self>) {
|
fn insert_checkpoint(&mut self, checkpoint: ThreadCheckpoint, cx: &mut Context<Self>) {
|
||||||
|
dbg!("insert_checkpoint");
|
||||||
self.checkpoints_by_message
|
self.checkpoints_by_message
|
||||||
.insert(checkpoint.message_id, checkpoint);
|
.insert(checkpoint.message_id, checkpoint);
|
||||||
cx.emit(ThreadEvent::CheckpointChanged);
|
cx.emit(ThreadEvent::CheckpointChanged);
|
||||||
|
@ -867,6 +872,7 @@ impl Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn last_restore_checkpoint(&self) -> Option<&LastRestoreCheckpoint> {
|
pub fn last_restore_checkpoint(&self) -> Option<&LastRestoreCheckpoint> {
|
||||||
|
dbg!();
|
||||||
self.last_restore_checkpoint.as_ref()
|
self.last_restore_checkpoint.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1492,13 +1492,19 @@ impl GitRepository for RealGitRepository {
|
||||||
let mut excludes = exclude_files(git).await?;
|
let mut excludes = exclude_files(git).await?;
|
||||||
|
|
||||||
git.run(&["add", "--all"]).await?;
|
git.run(&["add", "--all"]).await?;
|
||||||
let tree = git.run(&["write-tree"]).await?;
|
dbg!("added all files");
|
||||||
|
let tree = git.run(&["write-tree"]).await;
|
||||||
|
dbg!(&tree);
|
||||||
|
let tree = tree?;
|
||||||
let checkpoint_sha = if let Some(head_sha) = head_sha.as_deref() {
|
let checkpoint_sha = if let Some(head_sha) = head_sha.as_deref() {
|
||||||
|
dbg!(&["git", "commit-tree", &tree, "-p", head_sha, "-m", "Checkpoint"]));
|
||||||
git.run(&["commit-tree", &tree, "-p", head_sha, "-m", "Checkpoint"])
|
git.run(&["commit-tree", &tree, "-p", head_sha, "-m", "Checkpoint"])
|
||||||
.await?
|
.await?
|
||||||
} else {
|
} else {
|
||||||
|
dbg!(&["git", "commit-tree", &tree, "-m", "Checkpoint"]);
|
||||||
git.run(&["commit-tree", &tree, "-m", "Checkpoint"]).await?
|
git.run(&["commit-tree", &tree, "-m", "Checkpoint"]).await?
|
||||||
};
|
};
|
||||||
|
dbg!(&checkpoint_sha);
|
||||||
|
|
||||||
excludes.restore_original().await?;
|
excludes.restore_original().await?;
|
||||||
|
|
||||||
|
@ -1551,6 +1557,8 @@ impl GitRepository for RealGitRepository {
|
||||||
left: GitRepositoryCheckpoint,
|
left: GitRepositoryCheckpoint,
|
||||||
right: GitRepositoryCheckpoint,
|
right: GitRepositoryCheckpoint,
|
||||||
) -> BoxFuture<'_, Result<bool>> {
|
) -> BoxFuture<'_, Result<bool>> {
|
||||||
|
// todo! fail or short circuit
|
||||||
|
|
||||||
let working_directory = self.working_directory();
|
let working_directory = self.working_directory();
|
||||||
let git_binary_path = self.git_binary_path.clone();
|
let git_binary_path = self.git_binary_path.clone();
|
||||||
|
|
||||||
|
@ -1559,6 +1567,11 @@ impl GitRepository for RealGitRepository {
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let working_directory = working_directory?;
|
let working_directory = working_directory?;
|
||||||
let git = GitBinary::new(git_binary_path, working_directory, executor);
|
let git = GitBinary::new(git_binary_path, working_directory, executor);
|
||||||
|
log::error!(
|
||||||
|
"git diff-tree --quiet {} {}",
|
||||||
|
left.commit_sha,
|
||||||
|
right.commit_sha
|
||||||
|
);
|
||||||
let result = git
|
let result = git
|
||||||
.run(&[
|
.run(&[
|
||||||
"diff-tree",
|
"diff-tree",
|
||||||
|
@ -1567,6 +1580,7 @@ impl GitRepository for RealGitRepository {
|
||||||
&right.commit_sha.to_string(),
|
&right.commit_sha.to_string(),
|
||||||
])
|
])
|
||||||
.await;
|
.await;
|
||||||
|
dbg!(&result);
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => Ok(true),
|
Ok(_) => Ok(true),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue