Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,13 @@ worktree_dir = "review_trees"
timeout_seconds = 7200
max_retries = 3
ignore_files = ["MAINTAINERS", ".mailmap", ".gitignore", "LICENSES/"]

# Priority rules for patchset queue ordering (evaluated in order; last match wins).
# Range is 1 to 999. Default priority is 500. Values > 500 are elevated; values < 500 are deprioritized.
# [[review.priority_rules]]
# regex = "(?i)^PRODKERNEL:"
# priority = 750
#
# [[review.priority_rules]]
# regex = "(?i)security"
# priority = 999
15 changes: 15 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ async fn submit_patch(
let id = generate_synthetic_id("inject");
info!("Received raw mbox injection: {} (len: {})", id, raw.len());

let submitted_at = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs() as i64)
.ok();

let event = Event::RawMboxSubmitted {
raw,
submission_id: id.clone(),
Expand All @@ -405,6 +410,7 @@ async fn submit_patch(
baseline: base_commit,
skip_subjects,
only_subjects,
submitted_at,
};

if let Err(e) = state.sender.send(event).await {
Expand Down Expand Up @@ -467,6 +473,7 @@ async fn submit_patch(
None,
None,
None,
None,
)
.await
{
Expand Down Expand Up @@ -527,6 +534,7 @@ async fn submit_patch(
None,
None,
None,
None,
)
.await
{
Expand Down Expand Up @@ -614,6 +622,11 @@ async fn fetch_and_inject_thread(
})
.await??;

let submitted_at = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_secs() as i64)
.ok();

let event = Event::RawMboxSubmitted {
raw,
submission_id: msgid.to_string(),
Expand All @@ -622,6 +635,7 @@ async fn fetch_and_inject_thread(
baseline: None,
skip_subjects: None,
only_subjects: None,
submitted_at,
};

sender.send(event).await?;
Expand Down Expand Up @@ -1236,6 +1250,7 @@ async fn forge_webhook(
Some(subject),
Some(metadata.pr_number),
slug.as_deref(),
None,
)
.await
.map_err(|e| {
Expand Down
39 changes: 34 additions & 5 deletions src/baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,28 @@ impl BaselineRegistry {
// with the topic branch once the maintainer rebases.
if let Some(custom_remotes) = &self.custom_remotes {
for remote in custom_remotes {
// Fetch to ensure we have the latest branches (Issue 1)
if let Err(e) =
crate::git_ops::ensure_remote(&self.repo_path, &remote.name, &remote.url, false)
.await
// Build refspecs from branch_patterns to limit what we fetch.
// Each pattern like "*/6.18" becomes a refspec:
// +refs/heads/*/6.18:refs/remotes/<name>/*/6.18
let refspecs: Option<Vec<String>> =
remote.branch_patterns.as_ref().map(|patterns| {
patterns
.iter()
.map(|p| {
format!("+refs/heads/{}:refs/remotes/{}/{}", p, remote.name, p)
})
.collect()
});

// Fetch with refspecs to limit downloaded objects
if let Err(e) = crate::git_ops::ensure_remote_with_refspecs(
&self.repo_path,
&remote.name,
&remote.url,
false,
refspecs.as_deref(),
)
.await
{
warn!(
"Failed to ensure custom remote {}: {}. Using local branches.",
Expand All @@ -305,7 +323,16 @@ impl BaselineRegistry {
if remote.check_all_branches {
match crate::git_ops::get_remote_branches(&self.repo_path, &remote.name).await {
Ok(branches) => {
for branch in branches {
// Filter by branch_patterns if configured
let filtered = if let Some(ref patterns) = remote.branch_patterns {
branches
.into_iter()
.filter(|b| crate::git_ops::matches_branch_pattern(b, patterns))
.collect()
} else {
branches
};
for branch in filtered {
candidates.push(BaselineResolution::RemoteTarget {
url: remote.url.clone(),
name: remote.name.clone(),
Expand Down Expand Up @@ -915,6 +942,7 @@ F: patterns/
url: dummy_url,
check_all_branches: false,
only_branches: Some(vec!["master".to_string()]),
branch_patterns: None,
}]),
repo_path: repo_path.to_path_buf(),
mainline_remote: None,
Expand Down Expand Up @@ -954,6 +982,7 @@ F: patterns/
url: dummy_url,
check_all_branches: false,
only_branches: Some(vec!["topic-next".to_string()]),
branch_patterns: None,
}]),
repo_path: repo_path.to_path_buf(),
mainline_remote: None,
Expand Down
Loading