roll out save replacement
This commit is contained in:
parent
b3256e0b7c
commit
2537fea06c
4 changed files with 13 additions and 12 deletions
|
|
@ -6,7 +6,7 @@ from .git_tools import move_submodule
|
|||
import shutil
|
||||
from .find import _project_lookup_by_id
|
||||
from .tools import list2str, str2list
|
||||
from .tracker import get
|
||||
from .tracker import get, save
|
||||
from typing import Union, Optional
|
||||
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ def create_project(path: str, uuid: str, owner: Union[str, None]=None, tags: Uni
|
|||
c.execute("INSERT INTO projects (id, aliases, customTags, owner, code, created_at, updated_at) VALUES (?, ?, ?, ?, ?, datetime('now'), datetime('now'))", (uuid, alias_str, tag_str, owner, code))
|
||||
conn.commit()
|
||||
conn.close()
|
||||
dl.save(db, message="Added entry for project " + uuid + " to database", dataset=path)
|
||||
save(path, message="Added entry for project " + uuid + " to database", files=["backlogger.db"])
|
||||
|
||||
|
||||
def update_project_data(path: str, uuid: str, prop: str, value: Union[str, None] = None) -> None:
|
||||
|
|
@ -79,7 +79,7 @@ def update_aliases(path: str, uuid: str, aliases: list[str]) -> None:
|
|||
alias_str = list2str(new_alias_list)
|
||||
dl.unlock(db, dataset=path)
|
||||
update_project_data(path, uuid, "aliases", alias_str)
|
||||
dl.save(db, dataset=path)
|
||||
save(path, message="Updated aliases for project " + uuid, files=["backlogger.db"])
|
||||
return
|
||||
|
||||
|
||||
|
|
@ -109,11 +109,11 @@ def import_project(path: str, url: str, owner: Union[str, None]=None, tags: Opti
|
|||
in order to receive a uuid and have a consistent interface.
|
||||
|
||||
"""
|
||||
tmp_path = path + '/projects/tmp'
|
||||
tmp_path = os.path.join(path, 'projects/tmp')
|
||||
if not isDataset:
|
||||
dl.create(tmp_path, dataset=path)
|
||||
shutil.copytree(url + "/*", path + '/projects/tmp/')
|
||||
dl.save(tmp_path, dataset=path)
|
||||
save(path, message="Created temporary project dataset", files=['projects/tmp'])
|
||||
else:
|
||||
dl.install(path=tmp_path, source=url, dataset=path)
|
||||
tmp_ds = dl.Dataset(tmp_path)
|
||||
|
|
@ -128,7 +128,7 @@ def import_project(path: str, url: str, owner: Union[str, None]=None, tags: Opti
|
|||
create_project(path, uuid, owner, tags, aliases, code)
|
||||
move_submodule(path, 'projects/tmp', 'projects/' + uuid)
|
||||
os.mkdir(path + '/import_scripts/' + uuid)
|
||||
dl.save([db, path + '/projects/' + uuid], message="Import project from " + url, dataset=path)
|
||||
save(path, message="Import project from " + url, files=['projects/' + uuid, 'backlogger.db'])
|
||||
else:
|
||||
dl.drop(tmp_path, reckless='kill')
|
||||
shutil.rmtree(tmp_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue