+ git config
This commit is contained in:
@@ -161,7 +161,12 @@ class ResourceService:
|
||||
try:
|
||||
repo = self.git_service.get_repo(dashboard_id)
|
||||
if not repo:
|
||||
return None
|
||||
return {
|
||||
'branch': None,
|
||||
'sync_status': 'NO_REPO',
|
||||
'has_repo': False,
|
||||
'has_changes_for_commit': False
|
||||
}
|
||||
|
||||
# Check if there are uncommitted changes
|
||||
try:
|
||||
@@ -170,6 +175,7 @@ class ResourceService:
|
||||
|
||||
# Check for uncommitted changes
|
||||
is_dirty = repo.is_dirty()
|
||||
has_changes_for_commit = repo.is_dirty(untracked_files=True)
|
||||
|
||||
# Check for unpushed commits
|
||||
unpushed = len(list(repo.iter_commits(f'{branch}@{{u}}..{branch}'))) if '@{u}' in str(repo.refs) else 0
|
||||
@@ -181,14 +187,26 @@ class ResourceService:
|
||||
|
||||
return {
|
||||
'branch': branch,
|
||||
'sync_status': sync_status
|
||||
'sync_status': sync_status,
|
||||
'has_repo': True,
|
||||
'has_changes_for_commit': has_changes_for_commit
|
||||
}
|
||||
except Exception:
|
||||
logger.warning(f"[ResourceService][Warning] Failed to get git status for dashboard {dashboard_id}")
|
||||
return None
|
||||
return {
|
||||
'branch': None,
|
||||
'sync_status': 'ERROR',
|
||||
'has_repo': True,
|
||||
'has_changes_for_commit': False
|
||||
}
|
||||
except Exception:
|
||||
# No repo exists for this dashboard
|
||||
return None
|
||||
return {
|
||||
'branch': None,
|
||||
'sync_status': 'NO_REPO',
|
||||
'has_repo': False,
|
||||
'has_changes_for_commit': False
|
||||
}
|
||||
# [/DEF:_get_git_status_for_dashboard:Function]
|
||||
|
||||
# [DEF:_get_last_task_for_resource:Function]
|
||||
|
||||
Reference in New Issue
Block a user