Beispiel #1
0
 def __init__(self, process, stream, path, diff, showProgress):
     self.process = process
     self.stream = stream
     self.path = path
     self.diff = diff
     self.bytesRead = None
     self.progress = DisplayProgress() if showProgress else None
Beispiel #2
0
    def send(self, diff):
        """ Return Context Manager for a file-like (stream) object to send a diff. """
        if Store.skipDryRun(logger, self.dryrun)("send %s", diff):
            return None

        (diffTo, diffFrom) = self.toArg.diff(diff)
        self._client.send(diffTo, diffFrom)

        progress = DisplayProgress(diff.size) if self.showProgress is True else None
        return _SSHStream(self._client, progress)
Beispiel #3
0
    def receive(self, diff, paths):
        """ Return Context Manager for a file-like (stream) object to store a diff. """
        path = self.selectReceivePath(paths)
        path = self._relativePath(path)

        if Store.skipDryRun(logger, self.dryrun)("receive to %s", path):
            return None

        (diffTo, diffFrom) = self.toArg.diff(diff)
        self._client.receive(path, diffTo, diffFrom)

        progress = DisplayProgress(diff.size) if self.showProgress is True else None
        return _SSHStream(self._client, progress)