Add basic logic for updating symlink after snapshot removal
This commit is contained in:
parent
31a66fb438
commit
b5984da8bf
@ -113,15 +113,17 @@ class Repository(Hierarchy):
|
|||||||
:type index: int
|
:type index: int
|
||||||
"""
|
"""
|
||||||
snapshot_to_delete = self._snapshots[index]
|
snapshot_to_delete = self._snapshots[index]
|
||||||
|
|
||||||
# TODO add logic for deleting snapshot pointed to by self.snapshot_symlink
|
|
||||||
|
|
||||||
snapshot_to_delete.cleanup()
|
snapshot_to_delete.cleanup()
|
||||||
|
|
||||||
del self._snapshots[index]
|
del self._snapshots[index]
|
||||||
del self._snapshot_metadata[index]
|
del self._snapshot_metadata[index]
|
||||||
self.write_metadata(self._snapshot_metadata)
|
self.write_metadata(self._snapshot_metadata)
|
||||||
|
|
||||||
|
if not self._snapshot_metadata:
|
||||||
|
self.snapshot_symlink.unlink()
|
||||||
|
else:
|
||||||
|
self.snapshot_symlink.symlink_to(self._snapshots[-1])
|
||||||
|
|
||||||
def __getitem__(self, idx):
|
def __getitem__(self, idx):
|
||||||
"""Retrieve a Snapshot at a certain index."""
|
"""Retrieve a Snapshot at a certain index."""
|
||||||
return self._snapshots[idx]
|
return self._snapshots[idx]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user