Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions acceptance/bundle/sync/dryrun/output.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions acceptance/bundle/sync/dryrun/script
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions acceptance/bundle/sync/output.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions acceptance/bundle/sync/script
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions acceptance/cmd/sync-from-file/output.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions acceptance/cmd/sync-from-file/script
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions acceptance/cmd/sync/output.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
15 changes: 7 additions & 8 deletions acceptance/cmd/sync/script
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions libs/sync/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sync
import (
"context"
"fmt"
"sort"
"strings"
"time"
)
Expand Down Expand Up @@ -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, ", ")
Expand Down
Loading