clean up
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Rust / build (macos-latest, stable) (pull_request) Waiting to run
Rust / build (ubuntu-latest, stable) (pull_request) Waiting to run
Rust / build (windows-latest, stable) (pull_request) Waiting to run
This commit is contained in:
@@ -562,9 +562,6 @@ impl NewPullRequestView {
|
|||||||
|
|
||||||
let task: gpui::Task<Result<(), anyhow::Error>> =
|
let task: gpui::Task<Result<(), anyhow::Error>> =
|
||||||
cx.spawn_in(window, async move |this, cx| {
|
cx.spawn_in(window, async move |this, cx| {
|
||||||
// The fork and base must share history for a merge-base to exist.
|
|
||||||
// The target's mirror is the object store both sides land in.
|
|
||||||
// `ensure_repo_mirror` fetches `origin` when the mirror already exists.
|
|
||||||
let result = cx
|
let result = cx
|
||||||
.background_spawn({
|
.background_spawn({
|
||||||
let base = base.clone();
|
let base = base.clone();
|
||||||
@@ -575,10 +572,10 @@ impl NewPullRequestView {
|
|||||||
async move {
|
async move {
|
||||||
ensure_repo_mirror(&base, &base_clone_urls)?;
|
ensure_repo_mirror(&base, &base_clone_urls)?;
|
||||||
|
|
||||||
// Prune stale imports of any fork.
|
// Prune stale imports of any fork. Then import this fork's heads under its namespace.
|
||||||
// Then import this fork's heads under its namespace.
|
|
||||||
delete_refs_with_prefix(&mirror_path, "refs/fork")?;
|
delete_refs_with_prefix(&mirror_path, "refs/fork")?;
|
||||||
|
|
||||||
|
// Fetch the fork's refs and import them under the fork's namespace.
|
||||||
fetch_repo_refs(
|
fetch_repo_refs(
|
||||||
&mirror_path,
|
&mirror_path,
|
||||||
&clone_urls,
|
&clone_urls,
|
||||||
@@ -658,8 +655,6 @@ impl NewPullRequestView {
|
|||||||
let (base_branches, compare_branches) = match result {
|
let (base_branches, compare_branches) = match result {
|
||||||
Ok(branches) => branches,
|
Ok(branches) => branches,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
// Keep the previous source, if any.
|
|
||||||
// The error shows inline next to the compare bar.
|
|
||||||
self.error = Some(format!("Could not compare against the fork: {error}").into());
|
self.error = Some(format!("Could not compare against the fork: {error}").into());
|
||||||
cx.notify();
|
cx.notify();
|
||||||
return;
|
return;
|
||||||
@@ -673,8 +668,7 @@ impl NewPullRequestView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if base_branches.is_empty() {
|
if base_branches.is_empty() {
|
||||||
self.error =
|
self.error = Some("Could not list the target repository's branches.".into());
|
||||||
Some("Could not list the target repository's branches; try again later".into());
|
|
||||||
cx.notify();
|
cx.notify();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -687,11 +681,8 @@ impl NewPullRequestView {
|
|||||||
.map(SharedString::from)
|
.map(SharedString::from)
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Base defaults to the announced HEAD branch when the mirror has it.
|
|
||||||
// Otherwise `main`, then the first branch.
|
|
||||||
// The fork's `main` is the compare default, else the first branch.
|
|
||||||
// A refresh keeps the previous selection when the branch still exists.
|
|
||||||
let announced = self.store.read(cx).head.clone();
|
let announced = self.store.read(cx).head.clone();
|
||||||
|
|
||||||
let contains =
|
let contains =
|
||||||
|name: &str, list: &[SharedString]| list.iter().any(|branch| branch.as_ref() == name);
|
|name: &str, list: &[SharedString]| list.iter().any(|branch| branch.as_ref() == name);
|
||||||
|
|
||||||
@@ -790,16 +781,19 @@ impl NewPullRequestView {
|
|||||||
"{base_name} and {compare_name} share no common ancestor"
|
"{base_name} and {compare_name} share no common ancestor"
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let commits = worktree_commit_range_commits(
|
let commits = worktree_commit_range_commits(
|
||||||
Path::new(&repo_path),
|
Path::new(&repo_path),
|
||||||
&merge_base,
|
&merge_base,
|
||||||
&compare,
|
&compare,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let diff = worktree_commit_range_diff(
|
let diff = worktree_commit_range_diff(
|
||||||
Path::new(&repo_path),
|
Path::new(&repo_path),
|
||||||
&merge_base,
|
&merge_base,
|
||||||
&compare,
|
&compare,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok::<_, anyhow::Error>((merge_base, commits, diff))
|
Ok::<_, anyhow::Error>((merge_base, commits, diff))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -923,6 +917,7 @@ impl NewPullRequestView {
|
|||||||
let Some(repo_path) = self.work_path() else {
|
let Some(repo_path) = self.work_path() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(dock_area) = self.dock_area.upgrade() else {
|
let Some(dock_area) = self.dock_area.upgrade() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user