305 require(ssh.is_local, "local repository required") |
305 require(ssh.is_local, "local repository required") |
306 |
306 |
307 Isabelle_System.with_tmp_dir("sync") { tmp_dir => |
307 Isabelle_System.with_tmp_dir("sync") { tmp_dir => |
308 Hg_Sync.check_directory(target, ssh = context.ssh) |
308 Hg_Sync.check_directory(target, ssh = context.ssh) |
309 |
309 |
310 val context0 = context.copy(progress = new Progress) |
310 Rsync.init(context.no_progress, target) |
311 |
|
312 Rsync.init(context0, target) |
|
313 |
311 |
314 val id_content = id(rev = rev) |
312 val id_content = id(rev = rev) |
315 val is_changed = id_content.endsWith("+") |
313 val is_changed = id_content.endsWith("+") |
316 val log_content = if (is_changed) "" else log(rev = rev, options = "-l1") |
314 val log_content = if (is_changed) "" else log(rev = rev, options = "-l1") |
317 val diff_content = if (is_changed) diff(rev = rev, options = "--git") else "" |
315 val diff_content = if (is_changed) diff(rev = rev, options = "--git") else "" |
318 val stat_content = if (is_changed) diff(rev = rev, options = "--stat") else "" |
316 val stat_content = if (is_changed) diff(rev = rev, options = "--stat") else "" |
319 |
317 |
320 Rsync.init(context0, target, |
318 Rsync.init(context.no_progress, target, |
321 contents = |
319 contents = |
322 File.content(Hg_Sync.PATH_ID, id_content) :: |
320 File.content(Hg_Sync.PATH_ID, id_content) :: |
323 File.content(Hg_Sync.PATH_LOG, log_content) :: |
321 File.content(Hg_Sync.PATH_LOG, log_content) :: |
324 File.content(Hg_Sync.PATH_DIFF, diff_content) :: |
322 File.content(Hg_Sync.PATH_DIFF, diff_content) :: |
325 File.content(Hg_Sync.PATH_STAT, stat_content) :: contents) |
323 File.content(Hg_Sync.PATH_STAT, stat_content) :: contents) |
611 case Some(dir) => repository(dir) |
609 case Some(dir) => repository(dir) |
612 case None => the_repository(Path.current) |
610 case None => the_repository(Path.current) |
613 } |
611 } |
614 |
612 |
615 using(SSH.open_system(options, host = ssh_host, port = ssh_port, user = ssh_user)) { ssh => |
613 using(SSH.open_system(options, host = ssh_host, port = ssh_port, user = ssh_user)) { ssh => |
616 val context = Rsync.Context(progress, ssh = ssh, protect_args = protect_args) |
614 val context = Rsync.Context(progress = progress, ssh = ssh, protect_args = protect_args) |
617 hg.sync(context, target, thorough = thorough, dry_run = dry_run, |
615 hg.sync(context, target, thorough = thorough, dry_run = dry_run, |
618 filter = filter, rev = rev) |
616 filter = filter, rev = rev) |
619 } |
617 } |
620 } |
618 } |
621 ) |
619 ) |