From 352d5e60943b01da8178a69849cd2143a2513d7f Mon Sep 17 00:00:00 2001 From: Edwin Eefting Date: Sat, 17 Apr 2021 22:33:12 +0200 Subject: [PATCH] coverage --- zfs_autobackup/ZfsDataset.py | 41 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/zfs_autobackup/ZfsDataset.py b/zfs_autobackup/ZfsDataset.py index f78ec3a..0391f83 100644 --- a/zfs_autobackup/ZfsDataset.py +++ b/zfs_autobackup/ZfsDataset.py @@ -162,26 +162,27 @@ class ZfsDataset: else: return ZfsDataset(self.zfs_node, self.rstrip_path(1)) - def find_prev_snapshot(self, snapshot, also_other_snapshots=False): - """find previous snapshot in this dataset. None if it doesn't exist. - - also_other_snapshots: set to true to also return snapshots that where - not created by us. (is_ours) - - Args: - :type snapshot: str or ZfsDataset.ZfsDataset - :type also_other_snapshots: bool - """ - - if self.is_snapshot: - raise (Exception("Please call this on a dataset.")) - - index = self.find_snapshot_index(snapshot) - while index: - index = index - 1 - if also_other_snapshots or self.snapshots[index].is_ours(): - return self.snapshots[index] - return None + # NOTE: unused for now + # def find_prev_snapshot(self, snapshot, also_other_snapshots=False): + # """find previous snapshot in this dataset. None if it doesn't exist. + # + # also_other_snapshots: set to true to also return snapshots that where + # not created by us. (is_ours) + # + # Args: + # :type snapshot: str or ZfsDataset.ZfsDataset + # :type also_other_snapshots: bool + # """ + # + # if self.is_snapshot: + # raise (Exception("Please call this on a dataset.")) + # + # index = self.find_snapshot_index(snapshot) + # while index: + # index = index - 1 + # if also_other_snapshots or self.snapshots[index].is_ours(): + # return self.snapshots[index] + # return None def find_next_snapshot(self, snapshot, also_other_snapshots=False): """find next snapshot in this dataset. None if it doesn't exist