Skip to content

Commit f7d4448

Browse files
Change "josh" create name to "josh-core"
The "josh" create should become the "josh-cli" so that when published on cargo, "cargo install josh" installs the cli.
1 parent 89b9bec commit f7d4448

File tree

14 files changed

+244
-214
lines changed

14 files changed

+244
-214
lines changed

josh-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/josh-project/josh"
1010
version = "22.4.15"
1111

1212
[dependencies]
13-
josh = { path = "../josh-core" }
13+
josh-core = { path = "../josh-core" }
1414
josh-graphql = { path = "../josh-graphql" }
1515
josh-templates = { path = "../josh-templates" }
1616
anyhow = { workspace = true }

josh-cli/src/bin/josh.rs

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
use anyhow::Context;
44
use clap::Parser;
5-
use josh::changes::{PushMode, build_to_push};
6-
use josh::shell::Shell;
5+
use josh_core::changes::{PushMode, build_to_push};
6+
use josh_core::shell::Shell;
77

88
use std::io::IsTerminal;
99
use std::process::{Command as ProcessCommand, Stdio};
1010

11-
/// Helper function to convert josh::JoshError to anyhow::Error
12-
fn from_josh_err(err: josh::JoshError) -> anyhow::Error {
11+
/// Helper function to convert josh_core::JoshError to anyhow::Error
12+
fn from_josh_err(err: josh_core::JoshError) -> anyhow::Error {
1313
anyhow::anyhow!("{}", err.0)
1414
}
1515

@@ -42,7 +42,7 @@ fn spawn_git_command(
4242
command.status()?.code()
4343
} else {
4444
// Not in TTY: capture output and print stderr (for tests, CI, etc.)
45-
// Use the same approach as josh::shell::Shell for consistency
45+
// Use the same approach as josh_core::shell::Shell for consistency
4646
let output = command
4747
.stdin(Stdio::null())
4848
.stdout(Stdio::piped())
@@ -273,26 +273,26 @@ fn apply_josh_filtering(
273273
remote_name: &str,
274274
) -> anyhow::Result<()> {
275275
// Use josh API directly instead of calling josh-filter binary
276-
let filterobj = josh::filter::parse(filter)
276+
let filterobj = josh_core::filter::parse(filter)
277277
.map_err(from_josh_err)
278278
.context("Failed to parse filter")?;
279279

280-
josh::cache_sled::sled_load(&repo_path.join(".git"))
280+
josh_core::cache_sled::sled_load(&repo_path.join(".git"))
281281
.map_err(from_josh_err)
282282
.context("Failed to load sled cache")?;
283283

284284
let cache = std::sync::Arc::new(
285-
josh::cache_stack::CacheStack::new()
286-
.with_backend(josh::cache_sled::SledCacheBackend::default())
285+
josh_core::cache_stack::CacheStack::new()
286+
.with_backend(josh_core::cache_sled::SledCacheBackend::default())
287287
.with_backend(
288-
josh::cache_notes::NotesCacheBackend::new(repo_path)
288+
josh_core::cache_notes::NotesCacheBackend::new(repo_path)
289289
.map_err(from_josh_err)
290290
.context("Failed to create NotesCacheBackend")?,
291291
),
292292
);
293293

294294
// Open Josh transaction
295-
let transaction = josh::cache::TransactionContext::new(repo_path, cache.clone())
295+
let transaction = josh_core::cache::TransactionContext::new(repo_path, cache.clone())
296296
.open(None)
297297
.map_err(from_josh_err)?;
298298

@@ -315,8 +315,12 @@ fn apply_josh_filtering(
315315
}
316316

317317
// Apply the filter to all remote refs
318-
let (updated_refs, errors) =
319-
josh::filter_refs(&transaction, filterobj, &input_refs, josh::filter::empty());
318+
let (updated_refs, errors) = josh_core::filter_refs(
319+
&transaction,
320+
filterobj,
321+
&input_refs,
322+
josh_core::filter::empty(),
323+
);
320324

321325
// Check for errors
322326
for error in errors {
@@ -584,26 +588,26 @@ fn handle_push(args: &PushArgs) -> anyhow::Result<()> {
584588
.context("Failed to read filter from git config")?;
585589

586590
// Parse the filter using Josh API
587-
let filter = josh::filter::parse(&filter_str)
591+
let filter = josh_core::filter::parse(&filter_str)
588592
.map_err(from_josh_err)
589593
.context("Failed to parse filter")?;
590594

591-
josh::cache_sled::sled_load(repo_path)
595+
josh_core::cache_sled::sled_load(repo_path)
592596
.map_err(from_josh_err)
593597
.context("Failed to load sled cache")?;
594598

595599
let cache = std::sync::Arc::new(
596-
josh::cache_stack::CacheStack::new()
597-
.with_backend(josh::cache_sled::SledCacheBackend::default())
600+
josh_core::cache_stack::CacheStack::new()
601+
.with_backend(josh_core::cache_sled::SledCacheBackend::default())
598602
.with_backend(
599-
josh::cache_notes::NotesCacheBackend::new(repo_path)
603+
josh_core::cache_notes::NotesCacheBackend::new(repo_path)
600604
.map_err(from_josh_err)
601605
.context("Failed to create NotesCacheBackend")?,
602606
),
603607
);
604608

605609
// Open Josh transaction
606-
let transaction = josh::cache::TransactionContext::from_env(cache.clone())
610+
let transaction = josh_core::cache::TransactionContext::from_env(cache.clone())
607611
.map_err(from_josh_err)
608612
.context("Failed TransactionContext::from_env")?
609613
.open(None)
@@ -672,11 +676,11 @@ fn handle_push(args: &PushArgs) -> anyhow::Result<()> {
672676
let josh_remote_oid = josh_remote_reference.target().unwrap_or(git2::Oid::zero());
673677

674678
// Apply the filter to the josh remote ref to get the old filtered oid
675-
let (filtered_oids, errors) = josh::filter_refs(
679+
let (filtered_oids, errors) = josh_core::filter_refs(
676680
&transaction,
677681
filter,
678682
&[(josh_remote_ref.clone(), josh_remote_oid)],
679-
josh::filter::empty(),
683+
josh_core::filter::empty(),
680684
);
681685

682686
// Check for errors
@@ -709,21 +713,21 @@ fn handle_push(args: &PushArgs) -> anyhow::Result<()> {
709713
// Get author email from git config
710714
let author = config.get_string("user.email").unwrap_or_default();
711715

712-
let mut changes: Option<Vec<josh::Change>> =
716+
let mut changes: Option<Vec<josh_core::Change>> =
713717
if push_mode == PushMode::Stack || push_mode == PushMode::Split {
714718
Some(vec![])
715719
} else {
716720
None
717721
};
718722

719723
// Use Josh API to unapply the filter
720-
let unfiltered_oid = josh::history::unapply_filter(
724+
let unfiltered_oid = josh_core::history::unapply_filter(
721725
&transaction,
722726
filter,
723727
original_target,
724728
old_filtered_oid,
725729
local_commit,
726-
josh::history::OrphansMode::Keep,
730+
josh_core::history::OrphansMode::Keep,
727731
None, // reparent_orphans
728732
&mut changes, // change_ids
729733
)

josh-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "josh"
2+
name = "josh-core"
33
version = "22.4.15"
44
repository = "https://ithub.com/josh-project/josh"
55
authors = ["Christian Schilling <initcrash@gmail.com>"]

josh-filter/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/josh-project/josh"
1010
version = "22.4.15"
1111

1212
[dependencies]
13-
josh = { path = "../josh-core" }
13+
josh-core = { path = "../josh-core" }
1414
josh-graphql = { path = "../josh-graphql" }
1515
josh-templates = { path = "../josh-templates" }
1616
env_logger = { workspace = true }

0 commit comments

Comments
 (0)