-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_commits.py
More file actions
40 lines (30 loc) · 1.3 KB
/
test_commits.py
File metadata and controls
40 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
"""
Simple test script to verify the new commit functionality works correctly.
"""
import os
from git_repository_manager import GitRepository, GitCommit
def test_commit_functionality():
"""Test the new commit functionality"""
# Test with the current repository
current_repo_path = os.getcwd()
print(f"Testing commit functionality with repository: {current_repo_path}")
# Create a GitRepository instance
repo = GitRepository(current_repo_path)
# Test getting current branch and commits
try:
current_branch, commits = repo.get_current_branch_commits(10)
print(f"\nCurrent branch: {current_branch}")
print(f"Found {len(commits)} commits:")
for i, commit in enumerate(commits, 1):
print(f"\n{i}. SHA: {commit.commit_sha[:8]}")
print(f" Author: {commit.author}")
print(f" Date: {commit.date}")
print(f" Message: {commit.message}")
print(f" Branch heads: {commit.get_branch_names_display()}")
except Exception as e:
print(f"Error testing commit functionality: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_commit_functionality()