From a1b2d3bc7efe09da444388fc32eb805a8e7179c1 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Sat, 16 Jun 2018 19:33:06 -0300 Subject: [PATCH] =?UTF-8?q?Retira=20verifica=C3=A7=C3=A3o=20de=20hashes=20?= =?UTF-8?q?do=20annex=20ao=20exportar=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Já estamos usando verificando o mtime --- .../scripts/exporta_zope/exporta_zope.py | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/sapl/legacy/scripts/exporta_zope/exporta_zope.py b/sapl/legacy/scripts/exporta_zope/exporta_zope.py index 33a007230..5639a7665 100755 --- a/sapl/legacy/scripts/exporta_zope/exporta_zope.py +++ b/sapl/legacy/scripts/exporta_zope/exporta_zope.py @@ -379,12 +379,6 @@ def repo_execute(repo, cmd, *args): return repo.git.execute(cmd.split() + list(args)) -def get_annex_hashes(repo): - hashes = repo_execute( - repo, 'git annex find', '--format=${keyname}\n', '--include=*') - return {os.path.splitext(h)[0] for h in hashes.splitlines()} - - def ajusta_extensao(fullname, conteudo): base, extensao = os.path.splitext(fullname) if extensao not in ['.xsl', '.xslt', '.yaml', '.css']: @@ -393,23 +387,15 @@ def ajusta_extensao(fullname, conteudo): def build_salvar(repo): - """Constroi função salvar que pula arquivos que já estão no annex - """ - hashes = get_annex_hashes(repo) def salvar(fullname, conteudo): - sha = hashlib.sha256() - sha.update(conteudo) - if sha.hexdigest() in hashes: - print('- hash encontrado - {}'.format(fullname)) - else: - fullname = ajusta_extensao(fullname, conteudo) - if exists(fullname): - # destrava arquivo pré-existente (o conteúdo mudou) - repo_execute(repo, 'git annex unlock', fullname) - with open(fullname, 'w') as arq: - arq.write(conteudo) - print(fullname) + fullname = ajusta_extensao(fullname, conteudo) + if exists(fullname): + # destrava arquivo pré-existente (o conteúdo mudou) + repo_execute(repo, 'git annex unlock', fullname) + with open(fullname, 'w') as arq: + arq.write(conteudo) + print(fullname) return salvar