From b3cfbb3814f9ac7e2694cb97767331b0ab0ca326 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 20 Apr 2018 14:28:34 -0300 Subject: [PATCH] =?UTF-8?q?Salva=20exporta=C3=A7=C3=A3o=20parcial=20no=20r?= =?UTF-8?q?epo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/exporta_zope/exporta_zope.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py index fe95aac31..6420517f6 100755 --- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py +++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py @@ -18,10 +18,9 @@ import git import magic import pyaml import yaml -from unipath import Path - import ZODB.DB import ZODB.FileStorage +from unipath import Path from ZODB.broken import Broken EXTENSOES = { @@ -352,14 +351,20 @@ def dump_sapl(sigla): repo_execute(repo, 'git config annex.thin true') salvar = build_salvar(repo) - _dump_sapl(data_fs_path, destino, salvar) - - # grava mundaças - repo_execute(repo, 'git annex add sapl_documentos') - repo.git.add(A=True) - if 'master' not in repo.heads or repo.index.diff('HEAD'): - # se de fato existe mudança - repo.index.commit('Exporta documentos do zope') + try: + finalizado = False + _dump_sapl(data_fs_path, destino, salvar) + finalizado = True + finally: + # grava mundaças + repo_execute(repo, 'git annex add sapl_documentos') + 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__":