Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions sciunit2/command/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ def do_commit(self, pkgdir, rev, emgr, repo):
# adds the execution to de-duplication engine
sz = repo.checkin(rev, pkgdir, sp)
# adds the execution to the database
return (repo.location,) + emgr.commit(sz)
commit = emgr.commit(sz)
last_id = emgr.get_last_id()
return (last_id, repo,) + commit

def note(self, aList):
return "\n[%s %s] %s\n Date: %s\n" % (
sciunit2.workspace.project(aList[0]),
aList[1],
quoted(aList[2].cmd),
timestamp.fmt_rfc2822(aList[2].started))
return "\n[%s e%s] %s\n Date: %s\n" % (
sciunit2.workspace.project(aList[1].location),
aList[0],
quoted(aList[3].cmd),
timestamp.fmt_rfc2822(aList[3].started))
31 changes: 26 additions & 5 deletions sciunit2/command/rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def usage(self):
@staticmethod
def __to_rev(id_):
return 'e%d' % id_

@staticmethod
def __to_get_current_missing(ids):

ids = [int(i.lstrip('e')) for i in ids]
ids.sort()
missing_ids = [x for x in range(ids[0], ids[-1] + 1) if x not in ids]

return missing_ids


@staticmethod
def __to_id_range(revrange):
Expand Down Expand Up @@ -48,15 +58,26 @@ def run(self, args):
else:
arg = args[0]

ids = [rev for rev, _ in emgr.list()]

id_bound = self.__to_id_range(arg)

if ids:
ids = ids + ['e' + str(i) for i in id_bound]+ ['e0']
ids.append('e0')

repo_to_unlink = [self.__to_rev(i) for i in self.__to_get_current_missing(ids)]
for rev in repo_to_unlink:
repo.unlink(rev)

else:
for i in range(1, max(id_bound[0], id_bound[1]) + 1):
repo.unlink(self.__to_rev(i))

emgr.deletemany(arg)
# TODO: see if deletemany could return bounds
bounds = self.__to_id_range(arg)

# for id_b in range(bounds[0], bounds[1]):
# repo.unlink(self.__to_rev(id_b))
#
# for id_a in bounds:
# repo.unlink(self.__to_rev(id_a))
for _id in range(bounds[0], bounds[1]+1):
repo.unlink(self.__to_rev(_id))

Expand Down