Fixed git synchronization (#1582)

* fixed git synchronization

* Update CHANGELOG.md

Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com>
main
Andrey Zhavoronkov 6 years ago committed by GitHub
parent 1200ecf67c
commit 27efa89242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -49,7 +49,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed COCO keypoints skeleton parsing and saving (https://github.com/opencv/cvat/issues/1539) - Fixed COCO keypoints skeleton parsing and saving (https://github.com/opencv/cvat/issues/1539)
- Fixed an error when exporting a task with cuboids to any format except CVAT (https://github.com/opencv/cvat/pull/1577) - Fixed an error when exporting a task with cuboids to any format except CVAT (https://github.com/opencv/cvat/pull/1577)
- `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation (https://github.com/opencv/cvat/pull/1562) - `tf.placeholder() is not compatible with eager execution` exception for auto_segmentation (https://github.com/opencv/cvat/pull/1562)
- Fixed a problem with mask to polygons conversion when polygons are too small (https://github.com/opencv/cvat/pull/1581) - Synchronization with remote git repo (https://github.com/opencv/cvat/pull/1582)
- A problem with mask to polygons conversion when polygons are too small (https://github.com/opencv/cvat/pull/1581)
### Security ### Security
- -

@ -10,13 +10,12 @@ import re
import shutil import shutil
import subprocess import subprocess
from glob import glob from glob import glob
from tempfile import TemporaryDirectory import zipfile
import django_rq import django_rq
import git import git
from django.db import transaction from django.db import transaction
from django.utils import timezone from django.utils import timezone
from pyunpack import Archive
from cvat.apps.dataset_manager.task import export_task from cvat.apps.dataset_manager.task import export_task
from cvat.apps.engine.log import slogger from cvat.apps.engine.log import slogger
@ -284,16 +283,16 @@ class Git:
if ext == '.zip': if ext == '.zip':
shutil.move(dump_name, self._annotation_file) shutil.move(dump_name, self._annotation_file)
elif ext == '.xml': elif ext == '.xml':
with TemporaryDirectory() as tmp_dir: with zipfile.ZipFile(dump_name) as archive:
# TODO: remove extra packing-unpacking for f in archive.namelist():
Archive(src_path).extractall(tmp_dir) if f.endswith('.xml'):
anno_paths = glob(osp.join(tmp_dir, '**', '*.xml'), with open(self._annotation_file, 'wb') as output:
recursive=True) output.write(archive.read(f))
shutil.move(anno_paths[0], self._annotation_file) break
os.remove(dump_name)
else: else:
raise Exception("Got unknown annotation file type") raise Exception("Got unknown annotation file type")
os.remove(dump_name)
self._rep.git.add(self._annotation_file) self._rep.git.add(self._annotation_file)
# Merge diffs # Merge diffs

Loading…
Cancel
Save