src/Pure/Admin/sync_repos.scala
changeset 75499 c635368021b6
parent 75497 0a5f7b5da16f
child 75506 ee51db628e71
--- a/src/Pure/Admin/sync_repos.scala	Tue May 31 12:48:12 2022 +0200
+++ b/src/Pure/Admin/sync_repos.scala	Tue May 31 13:14:46 2022 +0200
@@ -10,6 +10,7 @@
 object Sync_Repos {
   def sync_repos(target: String,
     progress: Progress = new Progress,
+    port: Int = SSH.default_port,
     verbose: Boolean = false,
     thorough: Boolean = false,
     preserve_jars: Boolean = false,
@@ -27,8 +28,8 @@
     val more_filter = if (preserve_jars) List("include *.jar", "protect *.jar") else Nil
 
     def sync(hg: Mercurial.Repository, dest: String, r: String, filter: List[String] = Nil): Unit =
-      hg.sync(dest, rev = r, progress = progress, verbose = verbose, thorough = thorough,
-        dry_run = dry_run, clean = clean, filter = filter ::: more_filter)
+      hg.sync(dest, rev = r, progress = progress, port = port, verbose = verbose,
+        thorough = thorough, dry_run = dry_run, clean = clean, filter = filter ::: more_filter)
 
     progress.echo("\n* Isabelle repository:")
     sync(isabelle_hg, target, rev, filter = List("protect /AFP", "protect /etc/ISABELLE_ID"))
@@ -37,7 +38,7 @@
       Isabelle_System.with_tmp_dir("sync") { tmp_dir =>
         val id_path = tmp_dir + Path.explode("ISABELLE_ID")
         File.write(id_path, isabelle_hg.id(rev = rev))
-        Isabelle_System.rsync(thorough = thorough,
+        Isabelle_System.rsync(port = port, thorough = thorough,
           args = List(File.standard_path(id_path), target_dir + "etc/"))
       }
     }
@@ -58,6 +59,7 @@
         var afp_rev = ""
         var dry_run = false
         var rev = ""
+        var port = SSH.default_port
         var verbose = false
 
         val getopts = Getopts("""
@@ -73,6 +75,7 @@
     -f           force changes: no dry-run
     -n           no changes: dry-run
     -r REV       explicit revision (default: state of working directory)
+    -p PORT      explicit SSH port (default: """ + SSH.default_port + """)
     -v           verbose
 
   Synchronize Isabelle + AFP repositories; see also "isabelle hg_sync".
@@ -95,6 +98,7 @@
           "f" -> (_ => dry_run = false),
           "n" -> (_ => dry_run = true),
           "r:" -> (arg => rev = arg),
+          "p:" -> (arg => port = Value.Int.parse(arg)),
           "v" -> (_ => verbose = true))
 
         val more_args = getopts(args)
@@ -105,7 +109,7 @@
           }
 
         val progress = new Console_Progress
-        sync_repos(target, progress = progress, verbose = verbose, thorough = thorough,
+        sync_repos(target, progress = progress, port = port, verbose = verbose, thorough = thorough,
           preserve_jars = preserve_jars, dry_run = dry_run, clean = clean, rev = rev,
           afp_root = afp_root, afp_rev = afp_rev)
       }