mirror of
https://github.com/kopia/kopia.git
synced 2026-03-13 11:46:55 -04:00
fixed backups and expire command output
This commit is contained in:
@@ -95,13 +95,8 @@ func runBackupsCommand(context *kingpin.ParseContext) error {
|
||||
|
||||
sort.Sort(manifestSorter(manifests))
|
||||
|
||||
var lastTotalFileSize int64
|
||||
for _, m := range manifests {
|
||||
if m.Source != lastSource {
|
||||
fmt.Printf("\n%v\n", m.Source)
|
||||
lastSource = m.Source
|
||||
count = 0
|
||||
}
|
||||
|
||||
maybeIncomplete := ""
|
||||
if m.IncompleteReason != "" {
|
||||
if !*backupsIncludeIncomplete {
|
||||
@@ -110,6 +105,13 @@ func runBackupsCommand(context *kingpin.ParseContext) error {
|
||||
maybeIncomplete = " " + m.IncompleteReason
|
||||
}
|
||||
|
||||
if m.Source != lastSource {
|
||||
fmt.Printf("\n%v\n", m.Source)
|
||||
lastSource = m.Source
|
||||
count = 0
|
||||
lastTotalFileSize = m.Stats.TotalFileSize
|
||||
}
|
||||
|
||||
if count < *maxResultsPerPath {
|
||||
fmt.Printf(
|
||||
" %v%v %v %10v %v%v\n",
|
||||
@@ -117,7 +119,7 @@ func runBackupsCommand(context *kingpin.ParseContext) error {
|
||||
relPath,
|
||||
m.StartTime.Format("2006-01-02 15:04:05 MST"),
|
||||
units.BytesStringBase10(m.Stats.TotalFileSize),
|
||||
deltaBytes(m.Stats.Repository.WrittenBytes),
|
||||
deltaBytes(m.Stats.TotalFileSize-lastTotalFileSize),
|
||||
maybeIncomplete,
|
||||
)
|
||||
if *backupsShowItemID {
|
||||
@@ -130,6 +132,10 @@ func runBackupsCommand(context *kingpin.ParseContext) error {
|
||||
}
|
||||
count++
|
||||
}
|
||||
|
||||
if m.IncompleteReason == "" || !*backupsIncludeIncomplete {
|
||||
lastTotalFileSize = m.Stats.TotalFileSize
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -153,7 +159,7 @@ func deltaBytes(b int64) string {
|
||||
return "(+" + units.BytesStringBase10(b) + ")"
|
||||
}
|
||||
|
||||
return "(no change)"
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -68,6 +68,10 @@ func expireSnapshotsForSingleSource(snapshots []*snapshot.Manifest, pol *snapsho
|
||||
}
|
||||
}
|
||||
|
||||
if s.IncompleteReason != "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if pol.Expiration.KeepLatest != nil {
|
||||
registerSnapshot(fmt.Sprintf("%v", i), "latest", *pol.Expiration.KeepLatest)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user