Make the --dry-run warnings into logs so they appear without the -v flag

This commit is contained in:
Nick Craig-Wood 2016-01-31 15:53:09 +00:00
parent d4df3f2154
commit 5c37b777fc
2 changed files with 8 additions and 9 deletions

View File

@ -63,8 +63,7 @@ modification time or MD5SUM. Destination is updated to match
source, including deleting files if necessary. source, including deleting files if necessary.
**Important**: Since this can cause data loss, test first with the **Important**: Since this can cause data loss, test first with the
`--dry-run` and `-v` flags to see exactly what would be copied and `--dry-run` flag to see exactly what would be copied and deleted.
deleted.
Note that files in the destination won't be deleted if there were any Note that files in the destination won't be deleted if there were any
errors at any point. errors at any point.
@ -227,9 +226,9 @@ connection to go through to a remote object storage system. It is
### -n, --dry-run ### ### -n, --dry-run ###
Do a trial run with no permanent changes. Use this in combination Do a trial run with no permanent changes. Use this to see what rclone
with the `-v` flag to see what rclone would do without actually doing would do without actually doing it. Useful when setting up the `sync`
it. Useful when setting up the `sync` command. command which deletes files in the destination.
### --ignore-existing ### ### --ignore-existing ###

View File

@ -334,7 +334,7 @@ func PairCopier(in ObjectPairChan, fdst Fs, wg *sync.WaitGroup) {
src := pair.src src := pair.src
Stats.Transferring(src) Stats.Transferring(src)
if Config.DryRun { if Config.DryRun {
Debug(src, "Not copying as --dry-run") Log(src, "Not copying as --dry-run")
} else { } else {
Copy(fdst, pair.dst, src) Copy(fdst, pair.dst, src)
} }
@ -353,7 +353,7 @@ func PairMover(in ObjectPairChan, fdst Fs, wg *sync.WaitGroup) {
dst := pair.dst dst := pair.dst
Stats.Transferring(src) Stats.Transferring(src)
if Config.DryRun { if Config.DryRun {
Debug(src, "Not moving as --dry-run") Log(src, "Not moving as --dry-run")
} else if haveMover { } else if haveMover {
// Delete destination if it exists // Delete destination if it exists
if pair.dst != nil { if pair.dst != nil {
@ -386,7 +386,7 @@ func DeleteFiles(toBeDeleted ObjectsChan) {
defer wg.Done() defer wg.Done()
for dst := range toBeDeleted { for dst := range toBeDeleted {
if Config.DryRun { if Config.DryRun {
Debug(dst, "Not deleting as --dry-run") Log(dst, "Not deleting as --dry-run")
} else { } else {
Stats.Checking(dst) Stats.Checking(dst)
err := dst.Remove() err := dst.Remove()
@ -872,7 +872,7 @@ func Purge(f Fs) error {
if purger, ok := f.(Purger); ok { if purger, ok := f.(Purger); ok {
doFallbackPurge = false doFallbackPurge = false
if Config.DryRun { if Config.DryRun {
Debug(f, "Not purging as --dry-run set") Log(f, "Not purging as --dry-run set")
} else { } else {
err = purger.Purge() err = purger.Purge()
if err == ErrorCantPurge { if err == ErrorCantPurge {