def add_pure_change(self, change): """ 监测change的类型,并添加非垃圾change和不在黑名单中的change """ # 如果是黑名单及黑名单子目录的change,则跳过 for mute_list in [ keeper.mute_list for keeper in self.task_map.values() ]: for mute_path in mute_list: if path_is_parent(mute_path, change.path): print '...', change.type, change.path return # 寻找当前change对应的垃圾change,找到后删除;未找到则添加当前change trash_changes = self.find_related_trash_changes(change) if trash_changes: for change in trash_changes: self.changes.remove(change) print '- ', change.type, change.path else: self.changes.append(change) print '+ ', change.type, change.path self.compile_if_needed(change) ioloop.IOLoop.instance().add_callback( lambda: self.remove_outdated_changes(30))
def get_changes_since(self, timestamp, parent_path=None): ret = [] for change in self.changes: if change.timestamp > timestamp and ( not parent_path or path_is_parent(parent_path, change.path)): ret.append(change) return ret
def add_pure_change(self, change): """ 监测change的类型,并添加非垃圾change和不在黑名单中的change """ # 如果是黑名单及黑名单子目录的change,则跳过 for black_path in self.mute_list: if path_is_parent(black_path, change.path): print '...', change.type, change.path return # 寻找当前change对应的垃圾change,找到后删除;未找到则添加当前change trash_changes = self.find_related_trash_changes(change) if trash_changes: for change in trash_changes: self.changes.remove(change) print '- ', change.type, change.path else: self.changes.append(change) print '+ ', change.type, change.path self.compile_if_necessary(change) ioloop.IOLoop.instance().add_callback(lambda: self.remove_outdated_changes(30))
def find_project(self, child_path): for project in self.config.projects: if path_is_parent(project.path, child_path): return project return None
def get_changes_since(self, timestamp, parent_path=None): ret = [] for change in self.changes: if change.timestamp > timestamp and (not parent_path or path_is_parent(parent_path, change.path)): ret.append(change) return ret