clarified signature: avoid object-oriented "dispatch";
authorwenzelm
Sat, 08 Apr 2023 10:24:54 +0200
changeset 77782 127d077cccfe
parent 77781 c55c4c0c9ef9
child 77783 fb61887c069a
clarified signature: avoid object-oriented "dispatch";
src/Pure/General/mercurial.scala
src/Pure/General/ssh.scala
--- a/src/Pure/General/mercurial.scala	Mon Apr 03 21:16:32 2023 +0200
+++ b/src/Pure/General/mercurial.scala	Sat Apr 08 10:24:54 2023 +0200
@@ -300,7 +300,7 @@
       contents: List[File.Content] = Nil,
       rev: String = ""
     ): Unit = {
-      require(ssh == SSH.Local, "local repository required")
+      require(ssh.is_local, "local repository required")
 
       Isabelle_System.with_tmp_dir("sync") { tmp_dir =>
         val context0 = context.copy(progress = new Progress)
--- a/src/Pure/General/ssh.scala	Mon Apr 03 21:16:32 2023 +0200
+++ b/src/Pure/General/ssh.scala	Sat Apr 08 10:24:54 2023 +0200
@@ -105,6 +105,8 @@
   ) extends System {
     ssh =>
 
+    override def is_local: Boolean = false
+
     def port_suffix: String = if (port > 0) ":" + port else ""
     def user_prefix: String = if (user.nonEmpty) user + "@" else ""
 
@@ -370,6 +372,8 @@
   /* system operations */
 
   trait System extends AutoCloseable {
+    def is_local: Boolean
+
     def close(): Unit = ()
 
     override def toString: String = "SSH.Local"
@@ -424,5 +428,7 @@
       Platform.Family.parse(isabelle_platform.ISABELLE_PLATFORM_FAMILY)
   }
 
-  object Local extends System
+  object Local extends System {
+    override def is_local: Boolean = true
+  }
 }