1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-14 15:23:27 +00:00

Comments from @gilbertchen, thanks.

This commit is contained in:
niknah
2017-09-18 01:38:51 +10:00
parent f74ea0368e
commit f25783d59d
2 changed files with 7 additions and 14 deletions

View File

@@ -1698,12 +1698,10 @@ func (manager *BackupManager) CopySnapshots(otherManager *BackupManager, snapsho
if revisionMap[snapshot.ID][snapshot.Revision] == false { if revisionMap[snapshot.ID][snapshot.Revision] == false {
continue continue
} }
if !manager.config.dryRun {
otherManager.storage.CreateDirectory(0, fmt.Sprintf("snapshots/%s", snapshot.ID)) otherManager.storage.CreateDirectory(0, fmt.Sprintf("snapshots/%s", snapshot.ID))
description, _ := snapshot.MarshalJSON() description, _ := snapshot.MarshalJSON()
path := fmt.Sprintf("snapshots/%s/%d", snapshot.ID, snapshot.Revision) path := fmt.Sprintf("snapshots/%s/%d", snapshot.ID, snapshot.Revision)
otherManager.SnapshotManager.UploadFile(path, path, description) otherManager.SnapshotManager.UploadFile(path, path, description)
}
LOG_INFO("SNAPSHOT_COPY", "Copied snapshot %s at revision %d", snapshot.ID, snapshot.Revision) LOG_INFO("SNAPSHOT_COPY", "Copied snapshot %s at revision %d", snapshot.ID, snapshot.Revision)
} }

View File

@@ -2217,12 +2217,10 @@ func (manager *SnapshotManager) DownloadFile(path string, derivationKey string)
return nil return nil
} }
if !manager.config.dryRun {
err = manager.snapshotCache.UploadFile(0, path, manager.fileChunk.GetBytes()) err = manager.snapshotCache.UploadFile(0, path, manager.fileChunk.GetBytes())
if err != nil { if err != nil {
LOG_WARN("DOWNLOAD_FILE_CACHE", "Failed to add the file %s to the snapshot cache: %v", path, err) LOG_WARN("DOWNLOAD_FILE_CACHE", "Failed to add the file %s to the snapshot cache: %v", path, err)
} }
}
LOG_DEBUG("DOWNLOAD_FILE", "Downloaded file %s", path) LOG_DEBUG("DOWNLOAD_FILE", "Downloaded file %s", path)
@@ -2231,9 +2229,6 @@ func (manager *SnapshotManager) DownloadFile(path string, derivationKey string)
// UploadFile uploads a non-chunk file from the storage. // UploadFile uploads a non-chunk file from the storage.
func (manager *SnapshotManager) UploadFile(path string, derivationKey string, content []byte) bool { func (manager *SnapshotManager) UploadFile(path string, derivationKey string, content []byte) bool {
if manager.config.dryRun {
return true
}
manager.fileChunk.Reset(false) manager.fileChunk.Reset(false)
manager.fileChunk.Write(content) manager.fileChunk.Write(content)