cleanup: return status result (was taking args)
This commit is contained in:
@@ -206,12 +206,11 @@ class bam_session:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def status(session_rootdir,
|
def status(session_rootdir,
|
||||||
paths_add, paths_remove, paths_modified,
|
|
||||||
paths_uuid_update=None):
|
paths_uuid_update=None):
|
||||||
|
|
||||||
assert(isinstance(paths_add, dict))
|
paths_add = {}
|
||||||
assert(isinstance(paths_remove, dict))
|
paths_remove = {}
|
||||||
assert(isinstance(paths_modified, dict))
|
paths_modified = {}
|
||||||
|
|
||||||
from bam_utils.system import sha1_from_file
|
from bam_utils.system import sha1_from_file
|
||||||
|
|
||||||
@@ -267,6 +266,8 @@ class bam_session:
|
|||||||
if paths_uuid_update is not None:
|
if paths_uuid_update is not None:
|
||||||
paths_uuid_update[f_rel] = sha1_from_file(f_abs)
|
paths_uuid_update[f_rel] = sha1_from_file(f_abs)
|
||||||
|
|
||||||
|
return paths_add, paths_remove, paths_modified
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load_paths_uuid(session_rootdir):
|
def load_paths_uuid(session_rootdir):
|
||||||
with open(os.path.join(session_rootdir, ".bam_paths_uuid.json")) as f:
|
with open(os.path.join(session_rootdir, ".bam_paths_uuid.json")) as f:
|
||||||
@@ -274,15 +275,7 @@ class bam_session:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_dirty(session_rootdir):
|
def is_dirty(session_rootdir):
|
||||||
paths_add = {}
|
paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir)
|
||||||
paths_modified = {}
|
|
||||||
paths_remove = {}
|
|
||||||
|
|
||||||
bam_session.status(
|
|
||||||
session_rootdir,
|
|
||||||
paths_add, paths_remove, paths_modified
|
|
||||||
)
|
|
||||||
|
|
||||||
return any((paths_add, paths_modified, paths_remove))
|
return any((paths_add, paths_modified, paths_remove))
|
||||||
|
|
||||||
|
|
||||||
@@ -528,16 +521,9 @@ class bam_commands:
|
|||||||
deps_remap = json.load(f)
|
deps_remap = json.load(f)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
paths_add = {}
|
|
||||||
paths_modified = {}
|
|
||||||
paths_remove = {}
|
|
||||||
paths_uuid_update = {}
|
paths_uuid_update = {}
|
||||||
|
|
||||||
bam_session.status(
|
paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir, paths_uuid_update)
|
||||||
session_rootdir,
|
|
||||||
paths_add, paths_remove, paths_modified,
|
|
||||||
paths_uuid_update,
|
|
||||||
)
|
|
||||||
|
|
||||||
if not any((paths_add, paths_modified, paths_remove)):
|
if not any((paths_add, paths_modified, paths_remove)):
|
||||||
print("Nothing to commit!")
|
print("Nothing to commit!")
|
||||||
@@ -717,15 +703,7 @@ class bam_commands:
|
|||||||
del paths
|
del paths
|
||||||
|
|
||||||
session_rootdir = bam_config.find_sessiondir(path, abort=True)
|
session_rootdir = bam_config.find_sessiondir(path, abort=True)
|
||||||
|
paths_add, paths_remove, paths_modified = bam_session.status(session_rootdir)
|
||||||
paths_add = {}
|
|
||||||
paths_modified = {}
|
|
||||||
paths_remove = {}
|
|
||||||
|
|
||||||
bam_session.status(
|
|
||||||
session_rootdir,
|
|
||||||
paths_add, paths_remove, paths_modified,
|
|
||||||
)
|
|
||||||
|
|
||||||
if not use_json:
|
if not use_json:
|
||||||
for f in sorted(paths_add):
|
for f in sorted(paths_add):
|
||||||
|
Reference in New Issue
Block a user