You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 27, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,10 +54,17 @@ repodiff -b main -o output.txt
54
54
repodiff -c abc1234 -d 5678def -o output.txt
55
55
```
56
56
57
+
### Compare a Commit with its Parent (Previous) Commit
58
+
59
+
```bash
60
+
repodiff -c abc1234 -p -o output.txt
61
+
```
62
+
57
63
Parameters:
58
64
*`-b`, `--branch`: Branch to compare with (e.g., `main` or `master`)
59
65
*`-c`, `--commit1`: First commit hash
60
66
*`-d`, `--commit2`: Second commit hash
67
+
*`-p`, `--previous`: Compare the specified commit (via `-c`) with its parent commit
61
68
*`-o`, `--output_file`: (Optional) Path to the output file. If not provided, the diff will be written to a default file in the system's temporary directory.
62
69
*`-v`, `--version`: Display the current version of RepoDiff
Copy file name to clipboardExpand all lines: ai-workspace/core-prd.md
+4-136Lines changed: 4 additions & 136 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,7 @@ RepoDiff generates a simplified and context-aware unified diff of a Git reposito
13
13
***Context Lines** Defines the context for including the surrounding signatures.
14
14
3.**User-Friendly Output:** Generate a valid unified diff with clear placeholders (e.g., `⋮----`) indicating omitted code sections and an instructional header explaining the conventions.
15
15
4.**Configurable**: Allow users to set the config via a json file.
16
+
5.**Flexible Commit Comparison**: Support various ways to compare commits, including comparing a specific commit with its parent commit.
16
17
17
18
## 3. Example Configuration
18
19
@@ -70,8 +71,8 @@ This section details the handling of C# (`*.cs`) files.
70
71
***Behavior Summary:**
71
72
72
73
1.**Changed Methods:**
73
-
* If `include_method_body` is `true`: Include the entire body of each changed method
74
-
* If `include_method_body` is `false`: Replace the body with `⋮----`
74
+
* If `include_method_body` is `true`, Include the entire body of each changed method
75
+
* If `include_method_body` is `false`, Replace the body with `⋮----`
75
76
76
77
2.**Contextual Methods:**
77
78
* If `include_signatures` is `true`:
@@ -128,137 +129,4 @@ This section details the handling of C# (`*.cs`) files.
128
129
129
130
Include a header in the final diff explaining placeholders:
130
131
131
-
```
132
-
NOTE: Some method bodies have been replaced with "⋮----" to improve clarity for code reviews and LLM analysis.
133
-
134
-
- The "⋮----" placeholder indicates that a method body has been omitted or truncated based on the configuration settings.
135
-
- include_method_body: true, will cause the entire method to be included.
136
-
- include_signatures: true, will include the signatures of methods that surround the changed method.
137
-
```
138
-
## 8. Output Format
139
-
Generate a valid unified diff with adjusted hunk headers to reflect the included lines. Insert placeholder lines like `// ⋮----` (prefixed with a space as a context line) *within contextual methods* to indicate omitted code sections when the body exceeds `2 * context_lines` lines. Ensure that hunk headers accurately represent the line ranges shown, even when parts of method bodies are omitted, maintaining compatibility with unified diff parsers while clearly marking omitted code.
140
-
141
-
## 9. Pseudocode (Rust - Illustrative)
142
-
143
-
```rust
144
-
// Simplified and illustrative - not a complete implementation
fnapply_context_filter(hunks:&mutVec<Hunk>, context_lines:usize) {/* ... */ } //Helper for non .cs files
250
-
251
-
// Struct to represent method information (example)
252
-
structMethodInfo {
253
-
start_line:usize,
254
-
end_line:usize,
255
-
signature_line:usize,
256
-
name:String,
257
-
// ... other relevant data ...
258
-
}
259
-
```
260
-
261
-
## 10. Performance
262
-
263
-
***Single Git Command:** Efficient for a moderate number of changed files (e.g., 20-100).
264
-
***In-Memory Post-Processing:** The Rust implementation should be performant, with the most significant overhead likely coming from parsing (especially with Tree-sitter). Efficient data structures and algorithms should be used.
let commit1 = git_ops.get_previous_commit(&commit2)?;
58
+
59
+
// Print the commits being used for the comparison
60
+
println!(
61
+
"Comparing commit {} with its parent commit {}.",
62
+
&commit2[..12.min(commit2.len())],
63
+
&commit1[..12.min(commit1.len())]
64
+
);
65
+
50
66
(commit1, commit2)
51
67
}else{
52
68
if args.commit1.is_none() || args.commit2.is_none(){
53
-
eprintln!("You must either provide two commit hashes using --commit1 and --commit2, or use the -b option to compare against another branch.");
69
+
eprintln!("You must either provide two commit hashes using --commit1 and --commit2, or use the -b option to compare against another branch, or use -p with -c to compare with the previous commit.");
0 commit comments