Skip to content

Commit

Permalink
Merge pull request #760 from epage/shell
Browse files Browse the repository at this point in the history
refactor: Clean up
  • Loading branch information
epage authored Feb 27, 2024
2 parents 3d0b8ad + 4346ef1 commit a5cb47e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 82 deletions.
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

pub mod config;
mod diff;
pub mod error;
pub mod ops;
pub mod shell;
pub mod steps;
24 changes: 18 additions & 6 deletions src/ops/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,12 @@ pub fn set_workspace_version(

if dry_run {
if manifest != original_manifest {
let diff =
crate::diff::unified_diff(&original_manifest, &manifest, manifest_path, "updated");
let diff = crate::ops::diff::unified_diff(
&original_manifest,
&manifest,
manifest_path,
"updated",
);
log::debug!("change:\n{diff}");
}
} else {
Expand Down Expand Up @@ -278,8 +282,12 @@ pub fn set_package_version(manifest_path: &Path, version: &str, dry_run: bool) -

if dry_run {
if manifest != original_manifest {
let diff =
crate::diff::unified_diff(&original_manifest, &manifest, manifest_path, "updated");
let diff = crate::ops::diff::unified_diff(
&original_manifest,
&manifest,
manifest_path,
"updated",
);
log::debug!("change:\n{diff}");
}
} else {
Expand Down Expand Up @@ -314,8 +322,12 @@ pub fn upgrade_dependency_req(
let manifest = manifest.to_string();
if manifest != original_manifest {
if dry_run {
let diff =
crate::diff::unified_diff(&original_manifest, &manifest, manifest_path, "updated");
let diff = crate::ops::diff::unified_diff(
&original_manifest,
&manifest,
manifest_path,
"updated",
);
log::debug!("change:\n{diff}");
} else {
atomic_write(manifest_path, &manifest)?;
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ pub mod index;
pub mod replace;
pub mod shell;
pub mod version;

pub(crate) mod diff;
2 changes: 1 addition & 1 deletion src/ops/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn do_file_replacements(
format!(
"in {}\n{}",
path.display(),
crate::diff::unified_diff(&data, &replaced, &path, "replaced")
crate::ops::diff::unified_diff(&data, &replaced, &path, "replaced")
),
);
} else {
Expand Down
72 changes: 0 additions & 72 deletions src/shell.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/steps/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl CommitStep {
if ws_config.is_workspace {
let consolidate_commits = super::consolidate_commits(&selected_pkgs, &excluded_pkgs)?;
if !consolidate_commits {
let _ = crate::shell::warn(
let _ = crate::ops::shell::warn(
"ignoring `consolidate-commits=false`; `cargo release commit` can effectively only do one commit",
);
}
Expand Down

0 comments on commit a5cb47e

Please sign in to comment.