bisync: clarify file operation directions in dry-run logs - fixes #7029

Before this change, NOTICE log messages during bisync dry runs were unclear as
to the direction of the skipped operation (Path1 to 2 vs. 2 to 1.) This change
adjusts the cmd/bisync/log.go indent function to be more expressive about
direction.
This commit is contained in:
Kyle Reynolds 2024-03-06 07:26:53 -07:00 committed by GitHub
parent effad3fe4b
commit dcdbad3554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 28 deletions

View File

@ -29,6 +29,10 @@ func (b *bisyncRun) indent(tag, file, msg string) {
logf = fs.Logf logf = fs.Logf
} }
if b.opt.DryRun {
logf = fs.Logf
}
if tag == "Path1" { if tag == "Path1" {
tag = Color(terminal.CyanFg, "Path1") tag = Color(terminal.CyanFg, "Path1")
} else { } else {

View File

@ -67,11 +67,11 @@ INFO : Bisyncing with Comparison Settings:
} }
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}" INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Copying Path2 files to Path1 INFO : Copying Path2 files to Path1
INFO : - Path2 Resync is copying files to - Path1 NOTICE: - Path2 Resync is copying files to - Path1
NOTICE: file10.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file10.txt: Skipped copy as --dry-run is set (size 19)
NOTICE: file4.txt: Skipped copy as --dry-run is set (size 0) NOTICE: file4.txt: Skipped copy as --dry-run is set (size 0)
NOTICE: file6.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file6.txt: Skipped copy as --dry-run is set (size 19)
INFO : - Path1 Resync is copying files to - Path2 NOTICE: - Path1 Resync is copying files to - Path2
NOTICE: file1.txt: Skipped copy as --dry-run is set (size 0) NOTICE: file1.txt: Skipped copy as --dry-run is set (size 0)
NOTICE: file11.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file11.txt: Skipped copy as --dry-run is set (size 19)
NOTICE: file2.txt: Skipped copy as --dry-run is set (size 13) NOTICE: file2.txt: Skipped copy as --dry-run is set (size 13)
@ -97,21 +97,21 @@ INFO : Bisyncing with Comparison Settings:
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}" INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs INFO : Path1 checking for diffs
INFO : - Path1 File changed: size (larger), time (newer) - file2.txt NOTICE: - Path1 File changed: size (larger), time (newer) - file2.txt
INFO : - Path1 File was deleted - file4.txt NOTICE: - Path1 File was deleted - file4.txt
INFO : - Path1 File changed: size (larger), time (newer) - file5.txt NOTICE: - Path1 File changed: size (larger), time (newer) - file5.txt
INFO : - Path1 File was deleted - file6.txt NOTICE: - Path1 File was deleted - file6.txt
INFO : - Path1 File changed: size (larger), time (newer) - file7.txt NOTICE: - Path1 File changed: size (larger), time (newer) - file7.txt
INFO : - Path1 File is new - file11.txt NOTICE: - Path1 File is new - file11.txt
INFO : Path1: 6 changes:  1 new,  3 modified,  2 deleted INFO : Path1: 6 changes:  1 new,  3 modified,  2 deleted
INFO : (Modified:  3 newer,  0 older,  3 larger,  0 smaller) INFO : (Modified:  3 newer,  0 older,  3 larger,  0 smaller)
INFO : Path2 checking for diffs INFO : Path2 checking for diffs
INFO : - Path2 File changed: size (larger), time (newer) - file1.txt NOTICE: - Path2 File changed: size (larger), time (newer) - file1.txt
INFO : - Path2 File was deleted - file3.txt NOTICE: - Path2 File was deleted - file3.txt
INFO : - Path2 File changed: size (larger), time (newer) - file5.txt NOTICE: - Path2 File changed: size (larger), time (newer) - file5.txt
INFO : - Path2 File changed: size (larger), time (newer) - file6.txt NOTICE: - Path2 File changed: size (larger), time (newer) - file6.txt
INFO : - Path2 File was deleted - file7.txt NOTICE: - Path2 File was deleted - file7.txt
INFO : - Path2 File is new - file10.txt NOTICE: - Path2 File is new - file10.txt
INFO : Path2: 6 changes:  1 new,  3 modified,  2 deleted INFO : Path2: 6 changes:  1 new,  3 modified,  2 deleted
INFO : (Modified:  3 newer,  0 older,  3 larger,  0 smaller) INFO : (Modified:  3 newer,  0 older,  3 larger,  0 smaller)
INFO : Applying changes INFO : Applying changes
@ -120,25 +120,25 @@ ERROR : file5.txt: md5 differ
NOTICE: {path2String}: 1 differences found NOTICE: {path2String}: 1 differences found
NOTICE: {path2String}: 1 errors while checking NOTICE: {path2String}: 1 errors while checking
INFO : Finished checking the potential conflicts. 1 differences found INFO : Finished checking the potential conflicts. 1 differences found
INFO : - Path1 Queue copy to Path2 - {path2/}file11.txt NOTICE: - Path1 Queue copy to Path2 - {path2/}file11.txt
INFO : - Path1 Queue copy to Path2 - {path2/}file2.txt NOTICE: - Path1 Queue copy to Path2 - {path2/}file2.txt
INFO : - Path2 Queue delete - {path2/}file4.txt NOTICE: - Path2 Queue delete - {path2/}file4.txt
NOTICE: - WARNING New or changed in both paths - file5.txt NOTICE: - WARNING New or changed in both paths - file5.txt
NOTICE: file5.txt: Skipped rename as --dry-run is set NOTICE: file5.txt: Skipped rename as --dry-run is set
NOTICE: - Path1 Queue copy to Path2 - {path2/}file5.txt.conflict1 NOTICE: - Path1 Queue copy to Path2 - {path2/}file5.txt.conflict1
NOTICE: file5.txt: Skipped rename as --dry-run is set NOTICE: file5.txt: Skipped rename as --dry-run is set
NOTICE: - Path2 Queue copy to Path1 - {path1/}file5.txt.conflict2 NOTICE: - Path2 Queue copy to Path1 - {path1/}file5.txt.conflict2
INFO : - Path2 Queue copy to Path1 - {path1/}file6.txt NOTICE: - Path2 Queue copy to Path1 - {path1/}file6.txt
INFO : - Path1 Queue copy to Path2 - {path2/}file7.txt NOTICE: - Path1 Queue copy to Path2 - {path2/}file7.txt
INFO : - Path2 Queue copy to Path1 - {path1/}file1.txt NOTICE: - Path2 Queue copy to Path1 - {path1/}file1.txt
INFO : - Path2 Queue copy to Path1 - {path1/}file10.txt NOTICE: - Path2 Queue copy to Path1 - {path1/}file10.txt
INFO : - Path1 Queue delete - {path1/}file3.txt NOTICE: - Path1 Queue delete - {path1/}file3.txt
INFO : - Path2 Do queued copies to - Path1 NOTICE: - Path2 Do queued copies to - Path1
NOTICE: file1.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file1.txt: Skipped copy as --dry-run is set (size 19)
NOTICE: file10.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file10.txt: Skipped copy as --dry-run is set (size 19)
NOTICE: file3.txt: Skipped delete as --dry-run is set (size 0) NOTICE: file3.txt: Skipped delete as --dry-run is set (size 0)
NOTICE: file6.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file6.txt: Skipped copy as --dry-run is set (size 19)
INFO : - Path1 Do queued copies to - Path2 NOTICE: - Path1 Do queued copies to - Path2
NOTICE: file11.txt: Skipped copy as --dry-run is set (size 19) NOTICE: file11.txt: Skipped copy as --dry-run is set (size 19)
NOTICE: file2.txt: Skipped copy as --dry-run is set (size 13) NOTICE: file2.txt: Skipped copy as --dry-run is set (size 13)
NOTICE: file4.txt: Skipped delete as --dry-run is set (size 0) NOTICE: file4.txt: Skipped delete as --dry-run is set (size 0)

View File

@ -153,11 +153,11 @@ INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}filtersfile.txt INFO : Using filters file {workdir/}filtersfile.txt
INFO : Skipped storing filters file hash to {workdir/}filtersfile.txt.md5 as --dry-run is set INFO : Skipped storing filters file hash to {workdir/}filtersfile.txt.md5 as --dry-run is set
INFO : Copying Path2 files to Path1 INFO : Copying Path2 files to Path1
INFO : - Path2 Resync is copying files to - Path1 NOTICE: - Path2 Resync is copying files to - Path1
NOTICE: subdir: Skipped set directory modification time as --dry-run is set (size 4Ki) NOTICE: subdir: Skipped set directory modification time as --dry-run is set
NOTICE: {path1String}: Skipped set directory modification time as --dry-run is set NOTICE: {path1String}: Skipped set directory modification time as --dry-run is set
INFO : - Path1 Resync is copying files to - Path2 NOTICE: - Path1 Resync is copying files to - Path2
NOTICE: subdir: Skipped set directory modification time as --dry-run is set (size 4Ki) NOTICE: subdir: Skipped set directory modification time as --dry-run is set
NOTICE: {path2String}: Skipped set directory modification time as --dry-run is set NOTICE: {path2String}: Skipped set directory modification time as --dry-run is set
INFO : Resync updating listings INFO : Resync updating listings
INFO : Bisync successful INFO : Bisync successful