@@ -49,12 +49,25 @@ def get_commits_information(repo_url, from_tag=None, to_tag=None):
4949 :return: list of tuples with commit dates and messages
5050 """
5151
52+ from_tag = None if from_tag in ("" , None ) else from_tag # Normalize the starting tag
53+ to_tag = None if to_tag in ("" , None ) else to_tag # Normalize the ending tag
54+
55+ if from_tag is None and to_tag is None : # Check if both tags are missing
56+ repo = Repository (path_to_repo = repo_url ) # Analyze entire repository
57+ elif from_tag is None and to_tag is not None : # Check if only to_tag exists
58+ repo = Repository (path_to_repo = repo_url , to_tag = to_tag ) # Analyze from beginning to to_tag
59+ elif from_tag is not None and to_tag is None : # Check if only from_tag exists
60+ repo = Repository (path_to_repo = repo_url , from_tag = from_tag ) # Analyze from from_tag to HEAD
61+ else : # Both tags exist
62+ repo = Repository (path_to_repo = repo_url , from_tag = from_tag , to_tag = to_tag ) # Analyze between both tags
63+
5264 commits_list = [] # List to store the commit dates and messages
53- for index , commit in enumerate (Repository (path_to_repo = repo_url , from_tag = from_tag , to_tag = to_tag ).traverse_commits ()): # Iterate over the commits
54- commit_date = commit .committer_date .strftime ("%Y-%m-%d %H:%M:%S" ) # Get the commit date
55- commits_list .append ((index + 1 , commit .hash , commit_date , commit .msg )) # Append the index, commit date, and message to the list
5665
57- return commits_list # Return the list of tuples with commit dates and messages
66+ for index , commit in enumerate (repo .traverse_commits ()): # Iterate over the commits
67+ commit_date = commit .committer_date .strftime ("%Y-%m-%d %H:%M:%S" ) # Format the commit date
68+ commits_list .append ((index + 1 , commit .hash , commit_date , commit .msg )) # Append commit data to the list
69+
70+ return commits_list # Return the list of commit tuples
5871
5972def create_directory (full_directory_name , relative_directory_name ):
6073 """
0 commit comments