Compare commits

..

2 commits

Author SHA1 Message Date
Renovate Bot
e8ef80f0df chore(deps): update docker.io/rust docker tag to v1.81.0
All checks were successful
ci/woodpecker/pr/push-next Pipeline was successful
ci/woodpecker/pr/cron-docker-builder Pipeline was successful
ci/woodpecker/pr/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
2024-09-05 23:46:12 +00:00
7c2fbeb7c4 feat: optionally specify max commits between dev and main
Some checks failed
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
Rust / build (push) Failing after 8m48s
The default is 25.

Closes kemitix/git-next#121
2024-09-05 20:33:12 +01:00
5 changed files with 20 additions and 19 deletions

View file

@ -1,5 +1,8 @@
//
use git_next_core::git::{ForgeLike, RepoDetails};
use git_next_core::{
git::{ForgeLike, RepoDetails},
ForgeType,
};
#[cfg(feature = "forgejo")]
use git_next_forge_forgejo::ForgeJo;
@ -16,9 +19,9 @@ impl Forge {
pub fn create(repo_details: RepoDetails, net: Network) -> Box<dyn ForgeLike> {
match repo_details.forge.forge_type() {
#[cfg(feature = "forgejo")]
git_next_core::ForgeType::ForgeJo => Box::new(ForgeJo::new(repo_details, net)),
ForgeType::ForgeJo => Box::new(ForgeJo::new(repo_details, net)),
#[cfg(feature = "github")]
git_next_core::ForgeType::GitHub => Box::new(Github::new(repo_details, net)),
ForgeType::GitHub => Box::new(Github::new(repo_details, net)),
_ => {
drop(repo_details);
drop(net);

View file

@ -11,7 +11,7 @@ use git_next_core::{
#[test]
fn test_forgejo_name() {
let net = Network::new_mock();
let repo_details = given_repo_details(git_next_core::ForgeType::ForgeJo);
let repo_details = given_repo_details(ForgeType::ForgeJo);
let forge = Forge::create(repo_details, net);
assert_eq!(forge.name(), "forgejo");
}
@ -20,17 +20,20 @@ fn test_forgejo_name() {
#[test]
fn test_github_name() {
let net = Network::new_mock();
let repo_details = given_repo_details(git_next_core::ForgeType::GitHub);
let repo_details = given_repo_details(ForgeType::GitHub);
let forge = Forge::create(repo_details, net);
assert_eq!(forge.name(), "github");
}
#[allow(dead_code)]
fn given_repo_details(forge_type: git_next_core::ForgeType) -> RepoDetails {
let fs = kxio::fs::temp().unwrap_or_else(|e| {
fn given_fs() -> kxio::fs::FileSystem {
kxio::fs::temp().unwrap_or_else(|e| {
println!("{e}");
panic!("fs")
});
})
}
fn given_repo_details(forge_type: ForgeType) -> RepoDetails {
let fs = given_fs();
git::repo_details(
1,
git::Generation::default(),

View file

@ -54,7 +54,8 @@ impl<'a> Identity<'a> {
let mut spans = vec![" ".into()];
match alert {
None => spans.push(
Span::from(self.repo_alias.to_string()).style(Style::default().fg(Color::Cyan)),
Span::from(self.repo_alias.to_string())
.style(Style::default().fg(Color::Cyan).bg(Color::Black)),
),
Some(alert) => {
spans.push(

View file

@ -1,5 +1,3 @@
use crate::CommitCount;
//
use super::*;
@ -26,9 +24,7 @@ fn should_return_capacity_25_in_commit_log_when_searching_for_garbage() -> TestR
let_assert!(Ok(fs) = kxio::fs::temp());
let branch_name = given::a_branch_name();
let gitdir = GitDir::new(fs.base().to_path_buf(), StoragePathType::Internal);
let forge_details = given::forge_details().with_max_dev_commits(Some(CommitCount::from(25)));
let_assert!(Some(max_dev_commits) = forge_details.max_dev_commits());
assert!(**max_dev_commits >= 25);
let forge_details = given::forge_details();
let test_repository = git::repository::test(fs.clone(), forge_details);
let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
for _ in [0; 25] {
@ -45,9 +41,7 @@ fn should_return_5_in_commit_log_when_searching_for_5th_item() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp(), "create temp directory");
let branch_name = given::a_branch_name();
let gitdir = GitDir::new(fs.base().to_path_buf(), StoragePathType::Internal);
let forge_details = given::forge_details().with_max_dev_commits(Some(CommitCount::from(10)));
let_assert!(Some(max_dev_commits) = forge_details.max_dev_commits());
assert!(**max_dev_commits > 5);
let forge_details = given::forge_details();
let test_repository = git::repository::test(fs.clone(), forge_details);
let_assert!(
Ok(open_repository) = test_repository.open(&gitdir),

View file

@ -235,7 +235,7 @@ pub mod given {
pub fn a_number() -> u32 {
use rand::Rng;
let mut rng = rand::thread_rng();
rng.gen_range(5..100)
rng.gen_range(0..100)
}
pub fn a_branch_name() -> BranchName {