Tool to play through git commits.
When launched the git HEAD becomes detached and points to the very first commit. At the moment these commands are available:
b <step>
(a.k.a.back <step>
) : move the git pointer to the previous number ofsha
commits (the number is equal to the provided<step>
, the default<step>
is 1);n <step>
(a.k.a.next <step>
) : move the git pointer to the next number ofsha
commits (the number is equal to the provided<step>
, the default<step>
is 1);i
(a.k.a.info
) : get information about current commit in the format offile path
-status
;q
(a.k.a.quit
) : quit the program and move the git pointer will point to the latest commit sha that was available when thearcheologit
started;h
(a.k.a.help
) : list all available commands;
Supported commands are case-insensitive: b
/B
, n
/N
, q
/Q
, i
/I
, h
/H
work interchangeably.
After the up has been built & released (cargo build --release
/ make r
)
the artifact could be started with the following command:
target/release/archeologit --path /local/path/to/repo
The following RedisNumbersStats repo has around 100 commits and was very helpful during the testing. Project in action:
The sample cli output looks like
~/rust/archeologit:main ✗ ➭ target/release/archeologit --help
Tool to play through git commits
Usage: archeologit --path <PATH>
Options:
--path <PATH>
-h, --help Print help information
-V, --version Print version information
~/rust/archeologit:main ✗ ➭ target/release/archeologit --path /rust/RedisNumbersStats
Repo path: "/rust/RedisNumbersStats"
Total number of commits = 101 on a branch 'main'
[1/101] '99442217d532a3606950c2cfc75ceed59e7a272d' | 'Initial Empty Commit' by 'Brian Sam-Bodden <[email protected]>'
n
⏮ [2/101] 'd6727ae57241d7f3508d893b8c109ae81b358810' | 'cargo new --lib --name redis-ns RedisNumbersStats' by 'Brian Sam-Bodden <[email protected]>'
n
⏮ [3/101] '3afb2122b0b0cd4356ba29f3350fa141cae99490' | 'Add redis-module crate' by 'Brian Sam-Bodden <[email protected]>'
n 5
⏮ [8/101] '9479cd132ad7b835b3eb091ab92cc49aa8713cdf' | 'Add Section: Module Commands' by 'Brian Sam-Bodden <[email protected]>'
b
⏭ [7/101] '0cace0a486610ef323556962f3e7410ac31e68ff' | 'Import structs and types needed to module function' by 'Brian Sam-Bodden <[email protected]>'
b
⏭ [6/101] 'afd2a397ac86e19cb4e002833ac6d444ec43f67d' | 'Import macros from redis_module crate' by 'Brian Sam-Bodden <[email protected]>'
b 4
⏭ [2/101] 'd6727ae57241d7f3508d893b8c109ae81b358810' | 'cargo new --lib --name redis-ns RedisNumbersStats' by 'Brian Sam-Bodden <[email protected]>'
i
🔎
===== Added =====
[1] .gitignore
[2] Cargo.toml
[3] src/lib.rs
h
🤓 Archeologit v1.0.0. Reference
Supported commands are case insensitive
+----------+---------------------------------------------------------------+
| b <step> | ⏭ go to previous <step> commits; <step> is 1 by default |
+----------+---------------------------------------------------------------+
| n <step> | ⏮ go to next <step> commits; <step> is 1 by default |
+----------+---------------------------------------------------------------+
| i | 🔎 get information about current commit: file path and status |
+----------+---------------------------------------------------------------+
| h | 🤓 help, show command options |
+----------+---------------------------------------------------------------+
| q | 👋 quit |
+----------+---------------------------------------------------------------+
w
🙈 The command 'w' is not supported
q
👋 Moving to the latest commit and quiting!
- 🦀 error handling /
unwrap
usage - 🦀 string to enum conversion
- 🦀
let key = format!("{:?}", item.status());
=> what is the correctenum->string
conversion - 🦀
mut
vec & inline this works fine
let vec: &mut Vec<&str> = entry.get_mut();
vec.push(item.new_file().path().unwrap().to_str().unwrap());
let value: Vec<&str> = vec.to_vec();
entry.insert(value);
while inlining gives:
error[E0499]: cannot borrow `entry` as mutable more than once at a time
--> src/git.rs:48:17
|
46 | let vec: &mut Vec<&str> = entry.get_mut();
| --------------- first mutable borrow occurs here
47 | vec.push(item.new_file().path().unwrap().to_str().unwrap());
48 | entry.insert(vec.to_vec());
| ^^^^^^^^^^^^^------------^
| | |
| | first borrow later used here
| second mutable borrow occurs here
- 🦀
index
isusize
which doesn't work for negative numbers
Checking archeologit v0.1.0 (/Users/N778188/Documents/projects/other/rust/archeologit)
error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false
--> src/main.rs:97:20
|
97 | if index <= 0 {
| ^^^^^^^^^^
|
= help: because `0` is the minimum value for this type, the case where the two sides are not equal never occurs, consider using `index == 0` instead
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
= note: `#[deny(clippy::absurd_extreme_comparisons)]` on by default
----------------------------------------------------------------------------------------------------------------------------------
Total number of commits = 101 on a branch 'main'
[1/101] '99442217d532a3606950c2cfc75ceed59e7a272d' | 'Initial Empty Commit' by 'Brian Sam-Bodden <[email protected]>'
b
thread 'main' panicked at 'index out of bounds: the len is 101 but the index is 18446744073709551615', src/main.rs:100:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<< make: *** [e] Error 101