Browse Source

Salva exportação parcial no repo

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

13
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)
try:
finalizado = False
_dump_sapl(data_fs_path, destino, salvar) _dump_sapl(data_fs_path, destino, salvar)
finalizado = True
finally:
# grava mundaças # grava mundaças
repo_execute(repo, 'git annex add sapl_documentos') repo_execute(repo, 'git annex add sapl_documentos')
repo.git.add(A=True) repo.git.add(A=True)
if 'master' not in repo.heads or repo.index.diff('HEAD'): if 'master' not in repo.heads or repo.index.diff('HEAD'):
# se de fato existe mudança # se de fato existe mudança
repo.index.commit('Exporta documentos do zope') 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