From 325443e9bd4981369bec0739f35d9d5b0218d363 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Fri, 22 May 2020 12:10:16 +0300 Subject: [PATCH 1/2] fixed git synchronization --- cvat/apps/git/git.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cvat/apps/git/git.py b/cvat/apps/git/git.py index bb960a23bd73..5d0e817829b3 100644 --- a/cvat/apps/git/git.py +++ b/cvat/apps/git/git.py @@ -10,13 +10,12 @@ import shutil import subprocess from glob import glob -from tempfile import TemporaryDirectory +import zipfile import django_rq import git from django.db import transaction from django.utils import timezone -from pyunpack import Archive from cvat.apps.dataset_manager.task import export_task from cvat.apps.engine.log import slogger @@ -284,16 +283,16 @@ def push(self, user, scheme, host, db_task, last_save): if ext == '.zip': shutil.move(dump_name, self._annotation_file) elif ext == '.xml': - with TemporaryDirectory() as tmp_dir: - # TODO: remove extra packing-unpacking - Archive(src_path).extractall(tmp_dir) - anno_paths = glob(osp.join(tmp_dir, '**', '*.xml'), - recursive=True) - shutil.move(anno_paths[0], self._annotation_file) + with zipfile.ZipFile(dump_name) as archive: + for f in archive.namelist(): + if f.endswith('.xml'): + with open(self._annotation_file, 'wb') as output: + output.write(archive.read(f)) + break + os.remove(dump_name) else: raise Exception("Got unknown annotation file type") - os.remove(dump_name) self._rep.git.add(self._annotation_file) # Merge diffs From f077a848c221b10417a8e485d865938f7354fe87 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov <41117609+azhavoro@users.noreply.github.com> Date: Fri, 22 May 2020 12:16:08 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4195b379465e..6bb5bbc2d89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed an issue with large number of instances in instance mask (https://github.com/opencv/cvat/issues/1539) - Fixed full COCO dataset import error with conflicting labels in keypoints and detection (https://github.com/opencv/cvat/pull/1548) - Fixed COCO keypoints skeleton parsing and saving (https://github.com/opencv/cvat/issues/1539) +- Synchronization with remote git repo (https://github.com/opencv/cvat/pull/1582) ### Security -