Skip to content

Commit fac2d2f

Browse files
committed
Show what sync is doing
1 parent 3e7f12d commit fac2d2f

4 files changed

Lines changed: 22 additions & 3 deletions

File tree

pkg/devspace/sync/downstream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (d *downstream) downloadFiles(files []*fileInformation) (string, error) {
216216

217217
// Each file is represented in one line
218218
for _, element := range files {
219-
if lenFiles <= 3 {
219+
if lenFiles <= 3 || d.config.verbose {
220220
d.config.Logf("[Downstream] Download file %s, size: %d", element.Name, element.Size)
221221
}
222222

@@ -335,7 +335,7 @@ func (d *downstream) removeFilesAndFolders(removeFiles map[string]*fileInformati
335335
absFilepath := filepath.Join(d.config.WatchPath, key)
336336

337337
if shouldRemoveLocal(absFilepath, value, d.config) {
338-
if numRemoveFiles <= 3 {
338+
if numRemoveFiles <= 3 || d.config.verbose {
339339
d.config.Logf("[Downstream] Remove %s", key)
340340
}
341341

pkg/devspace/sync/sync_config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ type SyncConfig struct {
5050
upstream *upstream
5151
downstream *downstream
5252

53-
silent bool
53+
silent bool
54+
verbose bool
55+
5456
stopOnce sync.Once
5557
stopped bool
5658

pkg/devspace/sync/sync_config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func createTestSyncClient(testLocalPath, testRemotePath string) *SyncConfig {
3434
DestPath: testRemotePath,
3535

3636
testing: true,
37+
verbose: true,
3738
}
3839
}
3940

pkg/devspace/sync/upstream.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ func (u *upstream) applyCreates(files []*fileInformation) error {
251251
return errors.Trace(err)
252252
}
253253

254+
// Print changes
255+
if u.config.verbose {
256+
for _, c := range writtenFiles {
257+
if c.IsDirectory {
258+
u.config.Logf("[Upstream] Create Folder %s", c.Name)
259+
} else {
260+
u.config.Logf("[Upstream] Create File %s", c.Name)
261+
}
262+
}
263+
}
264+
254265
return u.uploadArchive(f, strconv.Itoa(int(stat.Size())), writtenFiles)
255266
}
256267

@@ -356,6 +367,11 @@ func (u *upstream) applyRemoves(files []*fileInformation) error {
356367
} else {
357368
delete(fileMap, relativePath)
358369
}
370+
371+
// Print changes
372+
if u.config.verbose {
373+
u.config.Logf("[Upstream] Remove %s", relativePath)
374+
}
359375
}
360376
}
361377

0 commit comments

Comments
 (0)