equal
deleted
inserted
replaced
251 |
251 |
252 def known_files(): List[String] = status(options = "--modified --added --clean --no-status") |
252 def known_files(): List[String] = status(options = "--modified --added --clean --no-status") |
253 |
253 |
254 def sync(target: String, |
254 def sync(target: String, |
255 progress: Progress = new Progress, |
255 progress: Progress = new Progress, |
|
256 port: Int = SSH.default_port, |
256 verbose: Boolean = false, |
257 verbose: Boolean = false, |
257 thorough: Boolean = false, |
258 thorough: Boolean = false, |
258 dry_run: Boolean = false, |
259 dry_run: Boolean = false, |
259 clean: Boolean = false, |
260 clean: Boolean = false, |
260 filter: List[String] = Nil, |
261 filter: List[String] = Nil, |
277 val source = File.standard_path(tmp_dir + Path.explode("archive")) |
278 val source = File.standard_path(tmp_dir + Path.explode("archive")) |
278 archive(source, rev = rev) |
279 archive(source, rev = rev) |
279 (Nil, source) |
280 (Nil, source) |
280 } |
281 } |
281 Isabelle_System.rsync( |
282 Isabelle_System.rsync( |
282 progress = progress, verbose = verbose, thorough = thorough, |
283 progress = progress, port = port, verbose = verbose, thorough = thorough, |
283 dry_run = dry_run, clean = clean, filter = filter, |
284 dry_run = dry_run, clean = clean, filter = filter, |
284 args = List("--prune-empty-dirs") ::: options ::: List("--", source + "/.", target)) |
285 args = List("--prune-empty-dirs") ::: options ::: List("--", source + "/.", target)) |
285 } |
286 } |
286 } |
287 } |
287 |
288 |
489 var filter: List[String] = Nil |
490 var filter: List[String] = Nil |
490 var root: Option[Path] = None |
491 var root: Option[Path] = None |
491 var thorough = false |
492 var thorough = false |
492 var dry_run = false |
493 var dry_run = false |
493 var rev = "" |
494 var rev = "" |
|
495 var port = SSH.default_port |
494 var verbose = false |
496 var verbose = false |
495 |
497 |
496 val getopts = Getopts(""" |
498 val getopts = Getopts(""" |
497 Usage: isabelle hg_sync [OPTIONS] TARGET |
499 Usage: isabelle hg_sync [OPTIONS] TARGET |
498 |
500 |
504 (default: implicit from current directory) |
506 (default: implicit from current directory) |
505 -T thorough treatment of file content and directory times |
507 -T thorough treatment of file content and directory times |
506 -f force changes: no dry-run |
508 -f force changes: no dry-run |
507 -n no changes: dry-run |
509 -n no changes: dry-run |
508 -r REV explicit revision (default: state of working directory) |
510 -r REV explicit revision (default: state of working directory) |
|
511 -p PORT explicit SSH port (default: """ + SSH.default_port + """) |
509 -v verbose |
512 -v verbose |
510 |
513 |
511 Synchronize Mercurial repository with TARGET directory, |
514 Synchronize Mercurial repository with TARGET directory, |
512 which can be local or remote (using notation of rsync). |
515 which can be local or remote (using notation of rsync). |
513 """, |
516 """, |
516 "R:" -> (arg => root = Some(Path.explode(arg))), |
519 "R:" -> (arg => root = Some(Path.explode(arg))), |
517 "T" -> (_ => thorough = true), |
520 "T" -> (_ => thorough = true), |
518 "f" -> (_ => dry_run = false), |
521 "f" -> (_ => dry_run = false), |
519 "n" -> (_ => dry_run = true), |
522 "n" -> (_ => dry_run = true), |
520 "r:" -> (arg => rev = arg), |
523 "r:" -> (arg => rev = arg), |
|
524 "p:" -> (arg => port = Value.Int.parse(arg)), |
521 "v" -> (_ => verbose = true)) |
525 "v" -> (_ => verbose = true)) |
522 |
526 |
523 val more_args = getopts(args) |
527 val more_args = getopts(args) |
524 val target = |
528 val target = |
525 more_args match { |
529 more_args match { |
531 val hg = |
535 val hg = |
532 root match { |
536 root match { |
533 case Some(dir) => repository(dir) |
537 case Some(dir) => repository(dir) |
534 case None => the_repository(Path.current) |
538 case None => the_repository(Path.current) |
535 } |
539 } |
536 hg.sync(target, progress = progress, verbose = verbose, thorough = thorough, |
540 hg.sync(target, progress = progress, port = port, verbose = verbose, thorough = thorough, |
537 dry_run = dry_run, clean = clean, filter = filter, rev = rev) |
541 dry_run = dry_run, clean = clean, filter = filter, rev = rev) |
538 } |
542 } |
539 ) |
543 ) |
540 } |
544 } |