tangled
alpha
login
or
join now
davidpdrsn.tngl.sh
/
jj-sync-prs
1
fork
atom
this repo has no description
1
fork
atom
overview
issues
pulls
2
pipelines
misc improvements
davidpdrsn.tngl.sh
8 months ago
f7e7a113
fa559be8
+23
-18
1 changed file
expand all
collapse all
unified
split
src
main.rs
+23
-18
src/main.rs
···
56
56
for stack_root in graph.iter_edges_from("main") {
57
57
let mut comment_lines = Vec::new();
58
58
write_pr_comment(&graph, stack_root, 0, &mut comment_lines);
59
59
-
create_or_update_comments(
60
60
-
&comment_lines,
61
61
-
stack_root,
62
62
-
&graph,
63
63
-
&pulls,
64
64
-
&octocrab,
65
65
-
&repo_info,
66
66
-
)
67
67
-
.await
68
68
-
.context("failed to sync stack comment")?;
59
59
+
60
60
+
if comment_lines.len() > 1 {
61
61
+
// if the comment contains just one line then its not
62
62
+
// part of a stack
63
63
+
create_or_update_comments(
64
64
+
&comment_lines,
65
65
+
stack_root,
66
66
+
&graph,
67
67
+
&pulls,
68
68
+
&octocrab,
69
69
+
&repo_info,
70
70
+
)
71
71
+
.await
72
72
+
.context("failed to sync stack comment")?;
73
73
+
}
69
74
}
70
75
71
76
Ok(())
···
81
86
"-r",
82
87
&format!("children({change}, 1)"),
83
88
"-T",
84
84
-
"change_id ++ \" \" ++ bookmarks ++ \"\n\"",
89
89
+
"change_id ++ \" \" ++ local_bookmarks ++ \"\n\"",
85
90
],
86
91
)?;
87
92
···
286
291
pulls[idx] = updated;
287
292
}
288
293
} else if cli.create_new {
289
289
-
eprintln!("creating PR from {target}<-{branch}");
290
294
let pull = octocrab
291
295
.pulls(&repo_info.owner, &repo_info.name)
292
296
.create(branch, branch, target)
···
294
298
.send()
295
299
.await
296
300
.with_context(|| format!("failed to create PR from {target}<-{branch}"))?;
301
301
+
if let Some(url) = &pull.html_url {
302
302
+
eprintln!("Created PR from {target}<-{branch}: {url}");
303
303
+
} else {
304
304
+
eprintln!("Created PR from {target}<-{branch}");
305
305
+
}
297
306
pulls.push(pull);
298
307
} else {
299
308
eprintln!("skipping creating PR from {target}<-{branch}");
···
361
370
.update_comment(existing_comment.id, comment)
362
371
.await
363
372
.context("failed to update comment")?;
364
364
-
if let Some(url) = &pull.html_url {
365
365
-
eprintln!("updated comment on {url}");
366
366
-
}
373
373
+
eprintln!("updated comment on #{}", pull.number);
367
374
}
368
375
} else {
369
376
octocrab
···
371
378
.create_comment(pull.number, comment)
372
379
.await
373
380
.context("failed to create comment")?;
374
374
-
if let Some(url) = &pull.html_url {
375
375
-
eprintln!("created comment on {url}");
376
376
-
}
381
381
+
eprintln!("created comment on #{}", pull.number);
377
382
}
378
383
379
384
Ok(())