Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Drupal
drupalizer
Commits
2c653e68
Commit
2c653e68
authored
Jun 22, 2016
by
Philippe Mouchel
Browse files
Init verif task, to check if repos are dirty
parent
e79b5bdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
2c653e68
...
...
@@ -8,6 +8,8 @@ from .environments import e
from
fabric.api
import
task
,
env
,
execute
import
helpers
as
h
from
os
import
path
from
fabric.colors
import
red
,
green
@
task
def
init
():
...
...
@@ -58,10 +60,47 @@ def update():
Update the full codebase and run the availabe database updates.
"""
verif
()
execute
(
drush
.
make
,
'update'
)
execute
(
drush
.
updatedb
)
execute
(
behat
.
init
)
@
task
def
verif
():
# STEP 1
# se mettre a la racine du projet
h
.
fab_cd
(
'local'
,
env
.
workspace
)
# chercher tous les repertoires .git (de maniere recursive)
repos
=
local
(
'find ./ -type d -name ".git"'
,
capture
=
True
).
splitlines
()
# pour chaque .git trouve, s'y rendre et voir ce qu'il en est
for
repo
in
repos
:
#repoLocalPath = path.join(env.workspace, repo).replace('/.git', '')
repoLocalPath
=
path
.
normpath
(
path
.
join
(
env
.
workspace
,
repo
,
'..'
))
with
h
.
fab_cd
(
'local'
,
repoLocalPath
):
print
green
(
'Verfiy repo in '
+
repoLocalPath
)
remoteName
=
local
(
'git remote'
,
capture
=
True
)
# - est ce que les branches locales existent sur la remote (git branch -vv)
remoteBranches
=
local
(
'git branch -rvv'
,
capture
=
True
).
splitlines
()
for
(
i
,
remoteBranch
)
in
enumerate
(
remoteBranches
):
remoteBranches
[
i
]
=
remoteBranch
.
replace
(
'* '
,
''
).
strip
().
split
(
' '
).
pop
(
0
)
localBranches
=
local
(
'git branch -lvv'
,
capture
=
True
).
splitlines
()
for
(
i
,
localBranch
)
in
enumerate
(
localBranches
):
localBranches
[
i
]
=
localBranch
.
replace
(
'* '
,
''
).
strip
().
split
(
' '
).
pop
(
0
)
for
localBranch
in
localBranches
:
if
((
remoteName
+
'/'
+
localBranch
)
not
in
remoteBranches
):
print
red
(
'Local branch "'
+
localBranch
+
'" is not present on "'
+
remoteName
+
'" remote.'
)
# to do, la pusher (git push remoteName localBranch)
# - pour chaque Branch, est ce qu'il y a des commits non-pushes (git branch -vv)
# - est ce qu'il y a du code non-stage (git status -s)
# on s'arrete a chaque alerte, et on demande quoi faire...
# 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
@
task
def
release
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment