diff --git a/acceptance/bundle/sync/dryrun/output.txt b/acceptance/bundle/sync/dryrun/output.txt index 765f2f8c6d..0fbcbe3d6a 100644 --- a/acceptance/bundle/sync/dryrun/output.txt +++ b/acceptance/bundle/sync/dryrun/output.txt @@ -1,6 +1,7 @@ >>> [CLI] bundle sync --dry-run --output text Warn: Running in dry-run mode. No actual changes will be made. +Action: PUT: .gitignore, databricks.yml, project-folder/app.py, project-folder/app.yaml, project-folder/query.sql Initial Sync Complete Uploaded .gitignore Uploaded databricks.yml diff --git a/acceptance/bundle/sync/dryrun/script b/acceptance/bundle/sync/dryrun/script index 66f1bb6de3..10b501d9de 100644 --- a/acceptance/bundle/sync/dryrun/script +++ b/acceptance/bundle/sync/dryrun/script @@ -14,5 +14,4 @@ cleanup() { } trap cleanup EXIT -# Note: output line starting with "Action: " lists files in non-deterministic order so we filter it out -trace $CLI bundle sync --dry-run --output text | grep -v "^Action: " | sort +trace $CLI bundle sync --dry-run --output text | sort diff --git a/acceptance/bundle/sync/output.txt b/acceptance/bundle/sync/output.txt index cd140e4fbe..9998cc47b1 100644 --- a/acceptance/bundle/sync/output.txt +++ b/acceptance/bundle/sync/output.txt @@ -1,5 +1,6 @@ >>> [CLI] bundle sync --output text +Action: PUT: .gitignore, databricks.yml, dryrun/databricks.yml, ignored-folder/folder1/script.py, ignored-folder/script.py Initial Sync Complete Uploaded .gitignore Uploaded databricks.yml diff --git a/acceptance/bundle/sync/script b/acceptance/bundle/sync/script index b14d3fe6ed..b3fb2a7d62 100644 --- a/acceptance/bundle/sync/script +++ b/acceptance/bundle/sync/script @@ -13,5 +13,4 @@ cleanup() { } trap cleanup EXIT -# Note: output line starting with "Action: " lists files in non-deterministic order so we filter it out -trace $CLI bundle sync --output text | grep -v "^Action: " | sort +trace $CLI bundle sync --output text | sort diff --git a/acceptance/cmd/sync-from-file/output.txt b/acceptance/cmd/sync-from-file/output.txt index 5d3c722b74..a47751a0d1 100644 --- a/acceptance/cmd/sync-from-file/output.txt +++ b/acceptance/cmd/sync-from-file/output.txt @@ -1,5 +1,6 @@ >>> [CLI] sync . /Users/[USERNAME] --exclude-from ignore.test-fixture +Action: PUT: .gitignore, ignore.test-fixture, project-folder/app.py, project-folder/app.yaml Initial Sync Complete Uploaded .gitignore Uploaded ignore.test-fixture @@ -8,6 +9,7 @@ Uploaded project-folder/app.py Uploaded project-folder/app.yaml >>> [CLI] sync . /Users/[USERNAME] --include-from ignore.test-fixture +Action: PUT: ignored-folder2/app.py, project-folder/app2.py, project-folder/blob/1, project-folder/blob/2, project-folder/query.sql, project-folder/static/folder1/1.txt, project-folder/static/folder2/2.txt Initial Sync Complete Uploaded ignored-folder2 Uploaded ignored-folder2/app.py diff --git a/acceptance/cmd/sync-from-file/script b/acceptance/cmd/sync-from-file/script index 1e1adce81b..a9e9c2a587 100644 --- a/acceptance/cmd/sync-from-file/script +++ b/acceptance/cmd/sync-from-file/script @@ -9,6 +9,5 @@ cleanup() { } trap cleanup EXIT -# Note: output line starting with "Action: " lists files in non-deterministic order so we filter it out -trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude-from 'ignore.test-fixture' | grep -v "^Action: " | sort -trace $CLI sync . /Users/$CURRENT_USER_NAME --include-from 'ignore.test-fixture' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude-from 'ignore.test-fixture' | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --include-from 'ignore.test-fixture' | sort diff --git a/acceptance/cmd/sync/output.txt b/acceptance/cmd/sync/output.txt index 198e997d4b..300b5f7f85 100644 --- a/acceptance/cmd/sync/output.txt +++ b/acceptance/cmd/sync/output.txt @@ -1,5 +1,6 @@ >>> [CLI] sync . /Users/[USERNAME] +Action: PUT: .gitignore, project-folder/app.py, project-folder/app.yaml, project-folder/query.sql Initial Sync Complete Uploaded .gitignore Uploaded project-folder @@ -8,26 +9,31 @@ Uploaded project-folder/app.yaml Uploaded project-folder/query.sql >>> [CLI] sync . /Users/[USERNAME] --exclude project-folder/app.* +Action: DELETE: project-folder/app.py, project-folder/app.yaml Deleted project-folder/app.py Deleted project-folder/app.yaml Initial Sync Complete >>> [CLI] sync . /Users/[USERNAME] --exclude project-folder/app.* --exclude project-folder/query.sql +Action: DELETE: project-folder/query.sql Deleted project-folder Deleted project-folder/query.sql Initial Sync Complete >>> [CLI] sync . /Users/[USERNAME] --exclude project-folder/app.* --exclude project-folder/query.sql --include ignored-folder/*.py +Action: PUT: ignored-folder/script.py Initial Sync Complete Uploaded ignored-folder Uploaded ignored-folder/script.py >>> [CLI] sync . /Users/[USERNAME] --exclude project-folder/app.* --exclude project-folder/query.sql --include ignored-folder/**/*.py +Action: PUT: ignored-folder/folder1/script.py Initial Sync Complete Uploaded ignored-folder/folder1 Uploaded ignored-folder/folder1/script.py >>> [CLI] sync . /Users/[USERNAME] --include ignored-folder/** --include !ignored-folder/folder1/big-blob +Action: PUT: ignored-folder/folder1/script.yaml, project-folder/app.py, project-folder/app.yaml, project-folder/query.sql Initial Sync Complete Uploaded ignored-folder/folder1/script.yaml Uploaded project-folder @@ -36,6 +42,7 @@ Uploaded project-folder/app.yaml Uploaded project-folder/query.sql >>> [CLI] sync . /Users/[USERNAME] +Action: DELETE: ignored-folder/folder1/script.py, ignored-folder/folder1/script.yaml, ignored-folder/script.py Deleted ignored-folder Deleted ignored-folder/folder1 Deleted ignored-folder/folder1/script.py diff --git a/acceptance/cmd/sync/script b/acceptance/cmd/sync/script index 5b9bcb2a3e..15d98f11b1 100644 --- a/acceptance/cmd/sync/script +++ b/acceptance/cmd/sync/script @@ -14,23 +14,22 @@ cleanup() { } trap cleanup EXIT -# Note: output line starting with "Action: " lists files in non-deterministic order so we filter it out -trace $CLI sync . /Users/$CURRENT_USER_NAME | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME | sort # excluding by mask: -trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' | sort # combining excludes: -trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' | sort # combining excludes and includes: -trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/*.py' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/*.py' | sort # include sub-folders: -trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/**/*.py' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --exclude 'project-folder/app.*' --exclude 'project-folder/query.sql' --include 'ignored-folder/**/*.py' | sort # use negated include to exclude files from syncing: -trace $CLI sync . /Users/$CURRENT_USER_NAME --include 'ignored-folder/**' --include '!ignored-folder/folder1/big-blob' | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME --include 'ignored-folder/**' --include '!ignored-folder/folder1/big-blob' | sort # subsequent call without include/exclude flag syncs files based on .gitignore: -trace $CLI sync . /Users/$CURRENT_USER_NAME | grep -v "^Action: " | sort +trace $CLI sync . /Users/$CURRENT_USER_NAME | sort diff --git a/libs/sync/event.go b/libs/sync/event.go index 4b488f4ede..643cdb39cc 100644 --- a/libs/sync/event.go +++ b/libs/sync/event.go @@ -3,6 +3,7 @@ package sync import ( "context" "fmt" + "sort" "strings" "time" ) @@ -54,9 +55,11 @@ func (e *EventChanges) IsEmpty() bool { func (e *EventChanges) String() string { var changes []string if len(e.Put) > 0 { + sort.Strings(e.Put) changes = append(changes, "PUT: "+strings.Join(e.Put, ", ")) } if len(e.Delete) > 0 { + sort.Strings(e.Delete) changes = append(changes, "DELETE: "+strings.Join(e.Delete, ", ")) } return strings.Join(changes, ", ")