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

Remove unusable command git remote get-url

parent 26c23e34
...@@ -46,14 +46,13 @@ def _checkRepo(repoLocalPath): ...@@ -46,14 +46,13 @@ def _checkRepo(repoLocalPath):
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)
filesStatusRawInfo = _getFilesStatusInformation() filesStatusRawInfo = _getFilesStatusInformation()
print green('Verify local files status against current HEAD commit...') print green('Verify local files status against current HEAD commit...')
nbWarnings += _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName) nbWarnings += _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName)
localBranchesRawInfo = _getLocalBranchesInformation() localBranchesRawInfo = _getLocalBranchesInformation()
print green('Verify local branches exist on remote "' + remoteName + '" (URL: ' + remoteURL + ')...'); print green('Verify local branches exist on remote "' + remoteName + '"...');
nbWarnings += _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName) nbWarnings += _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName)
print green('Verify branches status against remote...'); print green('Verify branches status against remote...');
...@@ -79,15 +78,6 @@ def _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName): ...@@ -79,15 +78,6 @@ def _checkFilesStatusVsHeadCommit(filesStatusRawInfo, remoteName):
'??': '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] + ')'))
if (nbWarnings > 0):
if (confirm(red('There are many files to be commited. Do you want to stage and commit these files?'), default=False)):
local('git add ' + ' '.join(addableFiles))
local('git commit -m "Automatic commit by Drupalizer: ' + time.strftime("%Y-%m-%d %H:%M:%S") +'"')
branchName = local('git name-rev --name-only HEAD', capture=True)
local('git push ' + remoteName + ' ' + branchName)
# Do not alert with diff as it has been commited and pushed
nbWarnings = 0
return nbWarnings return nbWarnings
def _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName): def _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName):
...@@ -100,12 +90,13 @@ def _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName): ...@@ -100,12 +90,13 @@ def _checkLocalBranchesExistOnRemote(localBranchesRawInfo, remoteName):
pushableBranches.append(localBranchName) pushableBranches.append(localBranchName)
print yellow('Local branch "' + localBranchName + '" is not present on "' + remoteName + '" remote.') print yellow('Local branch "' + localBranchName + '" is not present on "' + remoteName + '" remote.')
if (nbWarnings > 0): # TO DO : PUSHER LA BRANCHE SUR LE REPO
if (confirm(red('There are many local branches not present on remote. Do you want to sync theses?'), default=False)): # if (nbWarnings > 0):
for branchName in pushableBranches: # if (confirm(red('There are many local branches not present on remote. Do you want to sync theses?'), default=False)):
local('git push ' + remoteName + ' ' + branchName) # for branchName in pushableBranches:
# Do not alert with diff as it has been commited and pushed # local('git push ' + remoteName + ' ' + branchNqqqame)
nbWarnings = 0 # # Do not alert with diff as it has been commited and pushed
# nbWarnings = 0
return nbWarnings return nbWarnings
...@@ -116,6 +107,9 @@ def _checkLocalBranchesStatusVsRemote(localBranchesRawInfo, remoteName): ...@@ -116,6 +107,9 @@ def _checkLocalBranchesStatusVsRemote(localBranchesRawInfo, remoteName):
if (pattern.match(localBranchRawInfo)): if (pattern.match(localBranchRawInfo)):
nbWarnings += 1 nbWarnings += 1
print yellow('Local branch "' + _getBranchName(localBranchRawInfo) + '" is ahead of remote branch.'); print yellow('Local branch "' + _getBranchName(localBranchRawInfo) + '" is ahead of remote branch.');
# TO DO : PUSHER LA BRANCHE SUR LE REPO
return nbWarnings return nbWarnings
def _getLocalBranchesInformation(): def _getLocalBranchesInformation():
......
Markdown is supported
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