diff --git a/src/cli/backup/backup.go b/src/cli/backup/backup.go index e6db47210..b281affc0 100644 --- a/src/cli/backup/backup.go +++ b/src/cli/backup/backup.go @@ -217,7 +217,8 @@ func genericCreateCommand( if bo.Options.DryRun { // Print backup stats results here - print.All(ctx, bo.Results.Stats) + Info(ctx, "Discovered data:") + print.Item(ctx, bo.Results.Stats) continue } @@ -231,6 +232,10 @@ func genericCreateCommand( } } + if flags.RunModeFV == flags.RunModeDryRun { + return nil + } + bups, berrs := r.Backups(ctx, bIDs) if berrs.Failure() != nil { return Only(ctx, clues.Wrap(berrs.Failure(), "Unable to retrieve backup results from storage")) diff --git a/src/internal/m365/backup.go b/src/internal/m365/backup.go index 78921106e..f5756c0e4 100644 --- a/src/internal/m365/backup.go +++ b/src/internal/m365/backup.go @@ -5,7 +5,6 @@ import ( "github.com/alcionai/clues" - "github.com/alcionai/corso/src/internal/common/prefixmatcher" "github.com/alcionai/corso/src/internal/data" "github.com/alcionai/corso/src/internal/diagnostics" "github.com/alcionai/corso/src/internal/kopia" @@ -57,10 +56,10 @@ func (ctrl *Controller) ProduceBackupCollections( } var ( - colls []data.BackupCollection - ssmb *prefixmatcher.StringSetMatcher - canUsePreviousBackup bool - results inject.BackupProducerResults + // colls []data.BackupCollection + // ssmb *prefixmatcher.StringSetMatcher + // canUsePreviousBackup bool + results inject.BackupProducerResults ) switch service { @@ -89,7 +88,7 @@ func (ctrl *Controller) ProduceBackupCollections( } case path.SharePointService: - colls, ssmb, canUsePreviousBackup, err = sharepoint.ProduceBackupCollections( + colls, ssmb, canUsePreviousBackup, err := sharepoint.ProduceBackupCollections( ctx, bpc, ctrl.AC, @@ -102,7 +101,7 @@ func (ctrl *Controller) ProduceBackupCollections( results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup} case path.GroupsService: - colls, ssmb, err = groups.ProduceBackupCollections( + colls, ssmb, err := groups.ProduceBackupCollections( ctx, bpc, ctrl.AC, @@ -115,13 +114,12 @@ func (ctrl *Controller) ProduceBackupCollections( // canUsePreviousBacukp can be always returned true for groups as we // return a tombstone collection in case the metadata read fails - canUsePreviousBackup = true - results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: canUsePreviousBackup} + results = inject.BackupProducerResults{Collections: colls, Excludes: ssmb, CanUsePreviousBackup: true} default: return inject.BackupProducerResults{}, clues.Wrap(clues.New(service.String()), "service not supported").WithClues(ctx) } - for _, c := range colls { + for _, c := range results.Collections { // kopia doesn't stream Items() from deleted collections, // and so they never end up calling the UpdateStatus closer. // This is a brittle workaround, since changes in consumer diff --git a/src/internal/m365/collection/drive/collections.go b/src/internal/m365/collection/drive/collections.go index 7bbab4ea9..b1aad8aca 100644 --- a/src/internal/m365/collection/drive/collections.go +++ b/src/internal/m365/collection/drive/collections.go @@ -406,8 +406,6 @@ func (c *Collections) Get( stats.Items += c.NumFiles observe.Message(ctx, fmt.Sprintf("Discovered %d items to backup", c.NumItems)) - observe.Message(ctx, fmt.Sprintf("Discovered %d stats to backup", stats.Items)) - observe.Message(ctx, fmt.Sprintf("Discovered %d folder stats to backup", stats.Folders)) collections := []data.BackupCollection{} diff --git a/src/internal/operations/inject/containers.go b/src/internal/operations/inject/containers.go index baba6616e..568aa6568 100644 --- a/src/internal/operations/inject/containers.go +++ b/src/internal/operations/inject/containers.go @@ -90,6 +90,19 @@ func (s Stats) MinimumPrintable() any { // for printing out to a terminal in a columnar display. func (s Stats) Headers() []string { switch { + case s.Exchange != nil: + return []string{ + "EmailsAdded", + "EmailsDeleted", + "EmailFolders", + "ContactsAdded", + "ContactsDeleted", + "ContactFolders", + "EventsAdded", + "EventsDeleted", + "EventFolders", + } + case s.OneDrive != nil: return []string{ "Folders", @@ -105,6 +118,19 @@ func (s Stats) Headers() []string { // out to a terminal in a columnar display. func (s Stats) Values() []string { switch { + case s.Exchange != nil: + return []string{ + strconv.Itoa(s.Exchange.EmailsAdded), + strconv.Itoa(s.Exchange.EmailsDeleted), + strconv.Itoa(s.Exchange.EmailFolders), + strconv.Itoa(s.Exchange.ContactsAdded), + strconv.Itoa(s.Exchange.ContactsDeleted), + strconv.Itoa(s.Exchange.ContactFolders), + strconv.Itoa(s.Exchange.EventsAdded), + strconv.Itoa(s.Exchange.EventsDeleted), + strconv.Itoa(s.Exchange.EventFolders), + } + case s.OneDrive != nil: return []string{ strconv.Itoa(s.OneDrive.Folders),