diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-04-03 11:16:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-03 11:16:42 -0700 |
commit | 42757c18553bb2e6865efed4c912e3361012c49c (patch) | |
tree | 6fc8cf07f8751043f1c0ee25ad664810fd597d84 /pkg/adapter/runtime_remote.go | |
parent | 662ae6c0edd65db396c184c288fa93fce8023879 (diff) | |
parent | 576a80b0d75182a5ae12985c47bd31da72a51bc8 (diff) | |
download | podman-42757c18553bb2e6865efed4c912e3361012c49c.tar.gz podman-42757c18553bb2e6865efed4c912e3361012c49c.tar.bz2 podman-42757c18553bb2e6865efed4c912e3361012c49c.zip |
Merge pull request #2825 from baude/remotediff
add remote-client diff
Diffstat (limited to 'pkg/adapter/runtime_remote.go')
-rw-r--r-- | pkg/adapter/runtime_remote.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index dcc2d5aa6..c3a4f322d 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -831,3 +831,30 @@ func (r *LocalRuntime) Events(c *cliconfig.EventValues) error { } return nil } + +// Diff ... +func (r *LocalRuntime) Diff(c *cliconfig.DiffValues, to string) ([]archive.Change, error) { + var changes []archive.Change + reply, err := iopodman.Diff().Call(r.Conn, to) + if err != nil { + return nil, err + } + for _, change := range reply { + changes = append(changes, archive.Change{Path: change.Path, Kind: stringToChangeType(change.ChangeType)}) + } + return changes, nil +} + +func stringToChangeType(change string) archive.ChangeType { + switch change { + case "A": + return archive.ChangeAdd + case "D": + return archive.ChangeDelete + default: + logrus.Errorf("'%s' is unknown archive type", change) + fallthrough + case "C": + return archive.ChangeModify + } +} |