Commit ea0270ee authored by Philippe Mouchel's avatar Philippe Mouchel
Browse files

Print remote name and URL when checking + refactor

parent 06e0327c
...@@ -24,13 +24,28 @@ def isGitDirty(): ...@@ -24,13 +24,28 @@ def isGitDirty():
nbWarnings = 0 nbWarnings = 0
for repo in repos: for repo in repos:
repoLocalPath = path.normpath(path.join(repo, '..')) repoLocalPath = path.normpath(path.join(repo, '..'))
nbWarnings += _checkRepo(repoLocalPath)
return (nbWarnings > 0)
# STEP 2
# plutot que s'arreter ou continuer betement, on est intelligent et on demande quoi faire:
# - s'il y a du code non-stage, en faire un commit
# - si la Branch n'est pas trackee, la pusher
# - s'il y a des commits non pushes, les pusher
def _checkRepo(repoLocalPath):
nbWarnings = 0
with h.fab_cd('local', repoLocalPath): with h.fab_cd('local', repoLocalPath):
print green('---') print green('---')
print green('Verify repo in ' + repoLocalPath) print green('Verify repo in ' + repoLocalPath)
remoteName = local('git remote', capture=True) remoteName = local('git remote', capture=True)
remoteURL = local('git remote get-url ' + remoteName, capture=True)
print green('Verify local branches exist on remote...'); print green('Verify local branches exist on remote "' + remoteName + '" (URL: ' + remoteURL + ')...');
localBranchesRawInfo = _getLocalBranchesInformation() localBranchesRawInfo = _getLocalBranchesInformation()
for localBranchRawInfo in localBranchesRawInfo: for localBranchRawInfo in localBranchesRawInfo:
localBranchName = _getBranchName(localBranchRawInfo) localBranchName = _getBranchName(localBranchRawInfo)
...@@ -59,15 +74,9 @@ def isGitDirty(): ...@@ -59,15 +74,9 @@ def isGitDirty():
'??': 'is not indexed.', '??': 'is not indexed.',
}.get(fileStatusData[0], 'is in an unknown state (' + fileStatusData[0] + ')')) }.get(fileStatusData[0], 'is in an unknown state (' + fileStatusData[0] + ')'))
return (nbWarnings > 0) return nbWarnings
# STEP 2
# plutot que s'arreter ou continuer betement, on est intelligent et on demande quoi faire:
# - s'il y a du code non-stage, en faire un commit
# - si la Branch n'est pas trackee, la pusher
# - s'il y a des commits non pushes, les pusher
def _getLocalBranchesInformation(): def _getLocalBranchesInformation():
return local('git branch --list -vv', capture=True).splitlines() return local('git branch --list -vv', capture=True).splitlines()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment