Skip to content

Commit 59ef251

Browse files
CM-55207-Use consts
1 parent 3edc872 commit 59ef251

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cycode/cli/files_collector/commit_range_documents.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
logger = get_logger('Commit Range Collector')
2323

24+
COMMIT_RANGE_ALL = '--all'
2425

2526
def get_safe_head_reference_for_diff(repo: 'Repo') -> str:
2627
"""Get a safe reference to use for diffing against the current HEAD.
@@ -351,10 +352,10 @@ def calculate_pre_push_commit_range(push_update_details: str) -> Optional[str]:
351352
return f'{merge_base}..{local_object_name}'
352353

353354
logger.debug('Failed to find merge base with any default branch')
354-
return '--all'
355+
return COMMIT_RANGE_ALL
355356
except Exception as e:
356357
logger.debug('Failed to get repo for pre-push commit range calculation: %s', exc_info=e)
357-
return '--all'
358+
return COMMIT_RANGE_ALL
358359

359360
# If deleting a branch (local_object_name is all zeros), no need to scan
360361
if local_object_name == consts.EMPTY_COMMIT_SHA:
@@ -454,7 +455,7 @@ def parse_commit_range(commit_range: str, path: str) -> tuple[Optional[str], Opt
454455

455456
# Handle '--all' special case: scan all commits from first to HEAD
456457
# Usually represents an empty remote repository
457-
if commit_range == '--all':
458+
if commit_range == COMMIT_RANGE_ALL:
458459
try:
459460
head_commit = repo.rev_parse(consts.GIT_HEAD_COMMIT_REV).hexsha
460461
all_commits = repo.git.rev_list('--reverse', head_commit).strip()

0 commit comments

Comments
 (0)