get_operation and get_till_operation
This commit is contained in:
@@ -46,6 +46,24 @@ class HistoryDB(lazydb.LazyDB):
|
|||||||
def update_history(self):
|
def update_history(self):
|
||||||
self.history.update()
|
self.history.update()
|
||||||
|
|
||||||
|
def get_operation(self, operation):
|
||||||
|
for log in self.__logs:
|
||||||
|
if log.startswith("%03d_" % operation):
|
||||||
|
hist = pisi.history.History(os.path.join(ctx.config.history_dir(), log))
|
||||||
|
return hist.operation
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_till_operation(self, operation):
|
||||||
|
if not filter(lambda x:x.startswith("%03d_" % operation), self.__logs):
|
||||||
|
return
|
||||||
|
|
||||||
|
for log in self.__logs:
|
||||||
|
if log.startswith("%03d_" % operation):
|
||||||
|
return
|
||||||
|
|
||||||
|
hist = pisi.history.History(os.path.join(ctx.config.history_dir(), log))
|
||||||
|
yield hist.operation
|
||||||
|
|
||||||
def get_last(self, count=0):
|
def get_last(self, count=0):
|
||||||
count = count or len(self.__logs)
|
count = count or len(self.__logs)
|
||||||
for log in self.__logs[:count]:
|
for log in self.__logs[:count]:
|
||||||
|
|||||||
Reference in New Issue
Block a user