Skip to content

Commit 548ace7

Browse files
committed
feat(log): implement complete commit history and log operations
Add comprehensive commit history functionality with multi-level API: - Repository::log() for basic commit listing - Repository::recent_commits() for recent N commits - Repository::log_with_options() for advanced filtering - Repository::log_range() for commit ranges - Repository::log_for_paths() for path-specific history - Repository::show_commit() for detailed commit information Include rich types (Commit, CommitLog, Author, CommitMessage, CommitDetails, LogOptions) with iterator-based filtering and builder pattern for advanced queries. Add comprehensive example demonstrating all log functionality and update documentation.
1 parent 1a4aa9d commit 548ace7

File tree

8 files changed

+1702
-8
lines changed

8 files changed

+1702
-8
lines changed

CLAUDE.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,23 @@
3737
- Branch struct: name, branch_type, is_current, commit_hash, upstream tracking
3838
- BranchType enum: Local, RemoteTracking
3939
- BranchList: Box<[Branch]> with iterator methods (iter, local, remote), search (find, find_by_short_name), counting (len, local_count, remote_count)
40-
- **Core types**: Hash (in src/types.rs), IndexStatus, WorktreeStatus, FileEntry (in src/commands/status.rs), Branch, BranchList, BranchType (in src/commands/branch.rs)
40+
- **Commit history & log operations**: Multi-level API for comprehensive commit analysis
41+
- Repository::log() -> Result<CommitLog> - get all commits with simple API
42+
- Repository::recent_commits(count) -> Result<CommitLog> - get recent N commits
43+
- Repository::log_with_options(options) -> Result<LogOptions> - advanced queries with filters
44+
- Repository::log_range(from, to) -> Result<CommitLog> - commits between two points
45+
- Repository::log_for_paths(paths) -> Result<CommitLog> - commits affecting specific paths
46+
- Repository::show_commit(hash) -> Result<CommitDetails> - detailed commit information
47+
- Commit struct: hash, author, committer, message, timestamp, parents
48+
- CommitLog: Box<[Commit]> with iterator-based filtering (with_message_containing, since, until, merges_only, no_merges, find_by_hash)
49+
- LogOptions builder: max_count, since/until dates, author/committer filters, grep, paths, merge filtering
50+
- Author struct: name, email, timestamp with Display implementation
51+
- CommitMessage: subject and optional body parsing
52+
- CommitDetails: full commit info including file changes and diff stats
53+
- **Core types**: Hash (in src/types.rs), IndexStatus, WorktreeStatus, FileEntry (in src/commands/status.rs), Branch, BranchList, BranchType (in src/commands/branch.rs), Commit, CommitLog, Author, CommitMessage, CommitDetails, LogOptions (in src/commands/log.rs)
4154
- **Utility functions**: git(args, working_dir) -> Result<String>, git_raw(args, working_dir) -> Result<Output>
42-
- **Command modules**: status.rs, add.rs, commit.rs, branch.rs (in src/commands/)
43-
- **Testing**: 90+ tests covering all functionality with comprehensive edge cases
55+
- **Command modules**: status.rs, add.rs, commit.rs, branch.rs, log.rs (in src/commands/)
56+
- **Testing**: 101+ tests covering all functionality with comprehensive edge cases
4457
- Run `cargo fmt && cargo build && cargo test && cargo clippy --all-targets --all-features -- -D warnings` after code changes
4558
- Make sure all examples are running
4659

@@ -53,6 +66,7 @@ The `examples/` directory contains comprehensive demonstrations of library funct
5366
- **staging_operations.rs**: Staging operations - add(), add_all(), add_update() with before/after comparisons
5467
- **commit_workflows.rs**: Commit operations and Hash type - commit(), commit_with_author(), Hash methods
5568
- **branch_operations.rs**: Complete branch management - create/delete/checkout branches, BranchList filtering, branch type handling, search operations
69+
- **commit_history.rs**: Comprehensive commit history & log operations - demonstrates all commit querying APIs, filtering, analysis, and advanced LogOptions usage
5670
- **error_handling.rs**: Comprehensive error handling patterns - GitError variants, recovery strategies
5771

5872
Run examples with: `cargo run --example <example_name>`

Cargo.lock

Lines changed: 318 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
@@ -9,3 +9,4 @@ repository = "https://github.com/eugener/rustic-git"
99
readme = "README.md"
1010

1111
[dependencies]
12+
chrono = { version = "0.4", features = ["serde"] }

0 commit comments

Comments
 (0)