Add path-filtered repository history
This commit is contained in:
@@ -450,9 +450,10 @@ pub async fn load_branch_commits(
|
||||
owner: &str,
|
||||
repository: &str,
|
||||
branch: &str,
|
||||
path: Option<&str>,
|
||||
pages: u32,
|
||||
) -> Result<Page<HistoryCommit>, String> {
|
||||
load_commits_for_ref(server, owner, repository, Some(branch), pages)
|
||||
load_commits_for_ref(server, owner, repository, Some(branch), path, pages)
|
||||
.await
|
||||
.map(|page| Page {
|
||||
has_more: page.has_more,
|
||||
@@ -476,15 +477,24 @@ pub async fn load_all_commits(
|
||||
owner: &str,
|
||||
repository: &str,
|
||||
branches: &[String],
|
||||
path: Option<&str>,
|
||||
pages: u32,
|
||||
) -> Result<Page<HistoryCommit>, String> {
|
||||
let mut tasks = JoinSet::new();
|
||||
for (lane, branch) in branches.iter().cloned().enumerate() {
|
||||
let (server, owner, repository) =
|
||||
(server.clone(), owner.to_string(), repository.to_string());
|
||||
let path = path.map(str::to_string);
|
||||
tasks.spawn(async move {
|
||||
let commits =
|
||||
load_commits_for_ref(&server, &owner, &repository, Some(&branch), pages).await?;
|
||||
let commits = load_commits_for_ref(
|
||||
&server,
|
||||
&owner,
|
||||
&repository,
|
||||
Some(&branch),
|
||||
path.as_deref(),
|
||||
pages,
|
||||
)
|
||||
.await?;
|
||||
Ok::<_, String>((lane, branch, commits))
|
||||
});
|
||||
}
|
||||
@@ -1024,6 +1034,7 @@ async fn load_commits_for_ref(
|
||||
owner: &str,
|
||||
repository: &str,
|
||||
branch: Option<&str>,
|
||||
path: Option<&str>,
|
||||
pages: u32,
|
||||
) -> Result<Page<models::Commit>, String> {
|
||||
let client =
|
||||
@@ -1037,7 +1048,7 @@ async fn load_commits_for_ref(
|
||||
owner,
|
||||
repository,
|
||||
branch,
|
||||
None,
|
||||
path,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user