Browse Source

Salva exportação parcial no repo

pull/1916/head
Marcio Mazza 7 years ago
parent
commit
3feeb34db0
  1. 25
      sapl/legacy/scripts/exporta_zope/exporta_zope.py

25
sapl/legacy/scripts/exporta_zope/exporta_zope.py

@ -18,10 +18,9 @@ import git
import magic import magic
import pyaml import pyaml
import yaml import yaml
from unipath import Path
import ZODB.DB import ZODB.DB
import ZODB.FileStorage import ZODB.FileStorage
from unipath import Path
from ZODB.broken import Broken from ZODB.broken import Broken
EXTENSOES = { EXTENSOES = {
@ -352,14 +351,20 @@ def dump_sapl(sigla):
repo_execute(repo, 'git config annex.thin true') repo_execute(repo, 'git config annex.thin true')
salvar = build_salvar(repo) salvar = build_salvar(repo)
_dump_sapl(data_fs_path, destino, salvar) try:
finalizado = False
# grava mundaças _dump_sapl(data_fs_path, destino, salvar)
repo_execute(repo, 'git annex add sapl_documentos') finalizado = True
repo.git.add(A=True) finally:
if 'master' not in repo.heads or repo.index.diff('HEAD'): # grava mundaças
# se de fato existe mudança repo_execute(repo, 'git annex add sapl_documentos')
repo.index.commit('Exporta documentos do zope') repo.git.add(A=True)
if 'master' not in repo.heads or repo.index.diff('HEAD'):
# se de fato existe mudança
status = 'completa' if finalizado else 'parcial'
repo.index.commit(u'Exportação do zope {}'.format(status))
if finalizado:
repo.git.execute('git tag -f zope'.split())
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save