Add an -enum-only option to the backup command to enumerate the repository only

This commit is contained in:
Gilbert Chen
2018-05-24 11:34:46 -04:00
parent 72239a31c4
commit aadd2aa390
5 changed files with 32 additions and 12 deletions

View File

@@ -163,7 +163,7 @@ func setEntryContent(entries []*Entry, chunkLengths []int, offset int) {
// unmodified files with last backup). Otherwise (or if this is the first backup), the entire repository will
// be scanned to create the snapshot. 'tag' is the tag assigned to the new snapshot.
func (manager *BackupManager) Backup(top string, quickMode bool, threads int, tag string,
showStatistics bool, shadowCopy bool, shadowCopyTimeout int) bool {
showStatistics bool, shadowCopy bool, shadowCopyTimeout int, enumOnly bool) bool {
var err error
top, err = filepath.Abs(top)
@@ -194,6 +194,10 @@ func (manager *BackupManager) Backup(top string, quickMode bool, threads int, ta
return false
}
if enumOnly {
return true
}
// This cache contains all chunks referenced by last snasphot. Any other chunks will lead to a call to
// UploadChunk.
chunkCache := make(map[string]bool)
@@ -771,10 +775,7 @@ func (manager *BackupManager) Restore(top string, revision int, inPlace bool, qu
for _, file := range remoteSnapshot.Files {
if MatchPath(file.Path, patterns) {
LOG_TRACE("RESTORE_INCLUDE", "Include %s", file.Path)
includedFiles = append(includedFiles, file)
} else {
LOG_TRACE("RESTORE_EXCLUDE", "Exclude %s", file.Path)
}
}