projects
/
sitarba.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
comments, renames
[sitarba.git]
/
sitarba
diff --git
a/sitarba
b/sitarba
index d941c7048e5571099cf83ccfccb4b752b96329a5..b67925fd27435b8c236de566f5bfc58f175ca8c2 100755
(executable)
--- a/
sitarba
+++ b/
sitarba
@@
-356,7
+356,7
@@
class BackupManager:
return [ d for d in dirs if os.path.isdir(os.path.join(basedir, d)) ]
return [ d for d in dirs if os.path.isdir(os.path.join(basedir, d)) ]
- def list
Old
Backups(self):
+ def list
Existing
Backups(self):
"""Returns a list of old backups."""
backups = []
"""Returns a list of old backups."""
backups = []
@@
-463,7
+463,7
@@
class BackupManager:
then use mode for given epoch. Use given mode otherwise."""
now = datetime.datetime.now()
then use mode for given epoch. Use given mode otherwise."""
now = datetime.datetime.now()
- oldbackups = self.list
Old
Backups()
+ oldbackups = self.list
Existing
Backups()
# Get epoch of backup
if epoch == None:
# Get epoch of backup
if epoch == None:
@@
-540,14
+540,16
@@
class BackupManager:
"""Prune old backup files"""
allDirs = sorted(self.listAllDirs())
"""Prune old backup files"""
allDirs = sorted(self.listAllDirs())
- # Collect all directories
not matching backup name
+ # Collect all directories
that are removed
removeDirs = [ d for d in allDirs if not Backup.isBackupDir(d) ]
removeDirs = [ d for d in allDirs if not Backup.isBackupDir(d) ]
- # Get all
directories which are kept
- backups = self.list
Old
Backups()
- keepdirs = []
+ # Get all
backups
+ backups = self.list
Existing
Backups()
+ # Group backups by epoch and sort them by age
byepoch = { e : list(sorted( [ b for b in backups if b.epoch == e ], \
byepoch = { e : list(sorted( [ b for b in backups if b.epoch == e ], \
- key=lambda b : b.date, reverse=True)) for e in self.conf.getRealEpochsSorted() }
+ key=lambda b : b.date, reverse=True)) \
+ for e in self.conf.getRealEpochsSorted() }
+ # If we have too many backups of a specific epoch --> add them to remove list
for e in byepoch:
epoch = self.conf.epochs[e]
old = byepoch[e][epoch.numkeeps:]
for e in byepoch:
epoch = self.conf.epochs[e]
old = byepoch[e][epoch.numkeeps:]
@@
-708,7
+710,7
@@
if __name__ == "__main__":
man.backup(epoch, mode)
if cmd == "list":
man.backup(epoch, mode)
if cmd == "list":
- for b in sorted(man.list
Old
Backups(), key=lambda b: b.date):
+ for b in sorted(man.list
Existing
Backups(), key=lambda b: b.date):
print(b.colAlignedString())
if cmd == "prune":
print(b.colAlignedString())
if cmd == "prune":