fix for deleting a non-blend file
This commit is contained in:
@@ -52,7 +52,7 @@ def open_blend(filename, access="rb"):
|
||||
bfile.filepath_orig = filename
|
||||
return bfile
|
||||
elif magic[:2] == b'\x1f\x8b':
|
||||
log.debug("gzip blendfile detected?")
|
||||
log.debug("gzip blendfile detected")
|
||||
handle.close()
|
||||
log.debug("decompressing started")
|
||||
fs = gzip.open(filename, "rb")
|
||||
|
@@ -365,6 +365,7 @@ def global_setup():
|
||||
def global_teardown(data):
|
||||
p = data
|
||||
p.terminate()
|
||||
shutil.rmtree(TEMP_SERVER, ignore_errors=True)
|
||||
shutil.rmtree(TEMP, ignore_errors=True)
|
||||
|
||||
|
||||
@@ -620,6 +621,10 @@ class BamDeleteTest(BamSessionTestCase):
|
||||
|
||||
# remove the path
|
||||
shutil.rmtree(session_path)
|
||||
del session_path
|
||||
|
||||
# -----------
|
||||
# New Session
|
||||
|
||||
# checkout the file again
|
||||
stdout, stderr = bam_run(["checkout", "testfile.blend"], proj_path)
|
||||
@@ -627,13 +632,13 @@ class BamDeleteTest(BamSessionTestCase):
|
||||
|
||||
|
||||
# now delete the file we just checked out
|
||||
new_session_path = os.path.join(proj_path, "testfile")
|
||||
os.remove(os.path.join(new_session_path, "testfile.blend"))
|
||||
stdout, stderr = bam_run(["commit", "-m", "test deletion"], new_session_path)
|
||||
session_path = os.path.join(proj_path, "testfile")
|
||||
os.remove(os.path.join(session_path, "testfile.blend"))
|
||||
stdout, stderr = bam_run(["commit", "-m", "test deletion"], session_path)
|
||||
self.assertEqual("", stderr)
|
||||
# check if deletion of the file has happened
|
||||
|
||||
stdout, stderr = bam_run(["ls", "--json"], new_session_path)
|
||||
stdout, stderr = bam_run(["ls", "--json"], session_path)
|
||||
# check for errors in the response
|
||||
self.assertEqual("", stderr)
|
||||
|
||||
|
@@ -309,7 +309,7 @@ class FileAPI(Resource):
|
||||
|
||||
log.debug(path_ops)
|
||||
for file_path, operation in path_ops.items():
|
||||
|
||||
# TODO(fsiddi), collect all file paths and remove after
|
||||
if operation == 'D':
|
||||
file_path_abs = os.path.join(project.repository_path, file_path)
|
||||
assert(os.path.exists(file_path_abs))
|
||||
@@ -373,6 +373,9 @@ class FileAPI(Resource):
|
||||
)
|
||||
del zipfile
|
||||
|
||||
# simple case
|
||||
paths_remap[os.path.basename(filepath)] = os.path.basename(filepath)
|
||||
|
||||
# TODO, avoid reopening zipfile
|
||||
# append json info to zip
|
||||
import zipfile
|
||||
|
Reference in New Issue
Block a user