Skip to content
Merged
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
8 changes: 0 additions & 8 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ impl Conf {
} else {
count.parse().unwrap_or(1)
};
println!(
"DEBUG: prob={}, count={}, count_for_this_type={}, parsed_count={}",
probability, count, count_for_this_type, parsed_count
);
for _ in 0..count_for_this_type {
sequence.push(parsed_count);
}
Expand Down Expand Up @@ -214,10 +210,6 @@ impl Conf {
// Use PR number to index into the uniform sequence
let pr_index = (pr_number - 1) % 1000; // Convert to 0-based index
let result = sequence[pr_index as usize];
println!(
"DEBUG: pr_number={}, pr_index={}, result={}",
pr_number, pr_index, result
);
return result;
}

Expand Down
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn create_pull_request(
dry_run: bool,
gh_token: &str,
base_branch: &str,
) -> Result<String, String> {
) -> Result<(String, usize), String> {
let current_branch = git(&["branch", "--show-current"]);

// Checkout the base branch (will fetch from origin if needed)
Expand All @@ -357,6 +357,7 @@ fn create_pull_request(
// Now edit the files to create changes (after we're on the correct base branch)
let next_pr_number = last_pr + 1;
let words = edit_files_for_pr(filenames, next_pr_number, config);
let deps_count = words.len();

let branch_name = format!("change/{}", words.join("-"));
git(&["checkout", "-b", &branch_name]);
Expand Down Expand Up @@ -440,7 +441,7 @@ fn create_pull_request(
if dry_run {
git(&["checkout", &current_branch]);
git(&["pull"]);
return Ok((last_pr + 1).to_string());
return Ok(((last_pr + 1).to_string(), deps_count));
}

let result = try_gh(args.as_slice(), gh_token);
Expand All @@ -461,7 +462,7 @@ fn create_pull_request(
let caps = re.captures(pr_url.trim()).unwrap();
let pr_number = caps.get(2).map_or("", |m| m.as_str());

Ok(pr_number.to_string())
Ok((pr_number.to_string(), deps_count))
}

fn generate(config: &Conf, cli: &Cli) -> anyhow::Result<()> {
Expand Down Expand Up @@ -549,12 +550,13 @@ fn generate(config: &Conf, cli: &Cli) -> anyhow::Result<()> {
continue;
}
let duration = start.elapsed();
let pr = pr_result.unwrap();
let (pr, deps_count) = pr_result.unwrap();
println!(
"created pr: {} (target: {}) in {:?} // waiting: {} mins",
"created pr: {} (target: {}, deps: {}) in {}s // waiting: {} mins",
pr,
base_branch,
duration,
deps_count,
duration.as_secs(),
(pull_request_every as f32 / 60.0)
);
thread::sleep(Duration::from_secs(pull_request_every) / 2);
Expand Down