Skip to content

Commit 8dbce66

Browse files
nightkrdervoeti
authored andcommitted
Report patchable fetch progress (#1007)
* Report patchable fetch progress * Avoid clobbering child processes' output * Fix rustdoc warnings * Changelog
1 parent 98721bc commit 8dbce66

File tree

9 files changed

+348
-37
lines changed

9 files changed

+348
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ All notable changes to this project will be documented in this file.
2828
- trino-cli: Add version 470 ([#999]).
2929
- trino-storage-connector: Add version 470 ([#999]).
3030
- superset: Add version `4.1.1` ([#991]).
31-
- Add Patchable patch management tool ([#1003]).
31+
- Add Patchable patch management tool ([#1003], [#1007]).
3232
- nifi: Add 1.28.1, 2.2.0 ([#1006]).
3333

3434
### Changed
@@ -79,6 +79,7 @@ All notable changes to this project will be documented in this file.
7979
[#1000]: https://github.com/stackabletech/docker-images/pull/1000
8080
[#1003]: https://github.com/stackabletech/docker-images/pull/1003
8181
[#1006]: https://github.com/stackabletech/docker-images/pull/1006
82+
[#1007]: https://github.com/stackabletech/docker-images/pull/1007
8283

8384
## [24.11.1] - 2025-01-14
8485

Cargo.lock

Lines changed: 198 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ tempfile = "3.16.0"
1111
time = { version = "0.3.37", features = ["parsing"] }
1212
toml = "0.8.19"
1313
tracing = "0.1.41"
14+
tracing-indicatif = "0.3.9"
1415
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }

rust/patchable/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ tempfile.workspace = true
1212
time.workspace = true
1313
toml.workspace = true
1414
tracing.workspace = true
15+
tracing-indicatif.workspace = true
1516
tracing-subscriber.workspace = true

rust/patchable/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::{
1414
use git2::{Oid, Repository};
1515
use serde::{Deserialize, Serialize};
1616
use snafu::{OptionExt, ResultExt as _, Snafu};
17+
use tracing_indicatif::IndicatifLayer;
1718
use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _};
1819

1920
#[derive(clap::Parser)]
@@ -109,6 +110,8 @@ struct Opts {
109110
}
110111

111112
#[derive(clap::Parser)]
113+
// CLI parameters are documented for the CLI's `--help`, not for rustdoc
114+
#[allow(rustdoc::bare_urls, rustdoc::invalid_html_tags)]
112115
enum Cmd {
113116
/// Check out a patched source tree to docker-images/<PRODUCT>/patchable-work/worktree/<VERSION>
114117
///
@@ -221,6 +224,7 @@ type Result<T, E = Error> = std::result::Result<T, E>;
221224
fn main() -> Result<()> {
222225
tracing_subscriber::registry()
223226
.with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr))
227+
.with(IndicatifLayer::new())
224228
.with(
225229
tracing_subscriber::EnvFilter::builder()
226230
.with_default_directive(tracing_subscriber::filter::LevelFilter::INFO.into())

rust/patchable/src/patch.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ use std::{
55

66
use git2::{Oid, Repository};
77
use snafu::{OptionExt, ResultExt as _, Snafu};
8+
use tracing_indicatif::suspend_tracing_indicatif;
89

910
use crate::{
1011
error::{self, CommitId},
1112
patch_mail::{self, mailinfo, mailsplit},
1213
utils::raw_git_cmd,
1314
};
1415

16+
#[cfg(doc)]
17+
use crate::repo::ensure_worktree_is_at;
18+
1519
#[derive(Debug, Snafu)]
1620
pub enum Error {
1721
#[snafu(display("failed to open stgit series file {path:?}"))]
@@ -342,18 +346,20 @@ pub fn format_patches(
342346
}
343347

344348
tracing::info!("exporting commits since base");
345-
let status = raw_git_cmd(repo)
346-
.arg("format-patch")
347-
.arg(format!("{base_commit}..{leaf_commit}"))
348-
.arg("-o")
349-
.arg(patch_dir)
350-
.args([
351-
"--keep-subject",
352-
// By default, git includes its own version number as a suffix, which makes patches unstable across git versions
353-
"--no-signature",
354-
])
355-
.status()
356-
.context(RunFormatMailSnafu)?;
349+
let status = suspend_tracing_indicatif(|| {
350+
raw_git_cmd(repo)
351+
.arg("format-patch")
352+
.arg(format!("{base_commit}..{leaf_commit}"))
353+
.arg("-o")
354+
.arg(patch_dir)
355+
.args([
356+
"--keep-subject",
357+
// By default, git includes its own version number as a suffix, which makes patches unstable across git versions
358+
"--no-signature",
359+
])
360+
.status()
361+
})
362+
.context(RunFormatMailSnafu)?;
357363
if !status.success() {
358364
return FormatMailFailedSnafu { status }.fail();
359365
}

0 commit comments

Comments
 (0)