equal
deleted
inserted
replaced
7 package isabelle |
7 package isabelle |
8 |
8 |
9 |
9 |
10 object Rsync { |
10 object Rsync { |
11 sealed case class Context(progress: Progress, |
11 sealed case class Context(progress: Progress, |
12 port: Int = 0, |
12 ssh_port: Int = 0, |
|
13 ssh_control_path: String = "", |
13 archive: Boolean = true, |
14 archive: Boolean = true, |
14 protect_args: Boolean = true // requires rsync 3.0.0, or later |
15 protect_args: Boolean = true // requires rsync 3.0.0, or later |
15 ) { |
16 ) { |
16 def command: String = |
17 require(ssh_control_path.isEmpty || ssh_control_path == Bash.string(ssh_control_path), |
17 "rsync --rsh=" + Bash.string("ssh" + (if (port > 0) "-p " + port else "")) + |
18 "Malformed socket path: " + quote(ssh_control_path)) |
|
19 |
|
20 def command: String = { |
|
21 val ssh_command = |
|
22 "ssh" + (if (ssh_port > 0) " -p " + ssh_port else "") + |
|
23 (if (ssh_control_path.nonEmpty) " -o ControlPath=" + ssh_control_path else "") |
|
24 |
|
25 "rsync --rsh=" + Bash.string(ssh_command) + |
18 (if (archive) " --archive" else "") + |
26 (if (archive) " --archive" else "") + |
19 (if (protect_args) " --protect-args" else "") |
27 (if (protect_args) " --protect-args" else "") |
|
28 } |
20 } |
29 } |
21 |
30 |
22 def exec( |
31 def exec( |
23 context: Context, |
32 context: Context, |
24 verbose: Boolean = false, |
33 verbose: Boolean = false, |