src/Pure/General/mercurial.scala
changeset 80197 36547884db60
parent 80190 9f3e0d98fbec
equal deleted inserted replaced
80196:9308bc5f65d6 80197:36547884db60
   124     val PATH_ID: Path = PATH + Path.explode("id")
   124     val PATH_ID: Path = PATH + Path.explode("id")
   125     val PATH_LOG: Path = PATH + Path.explode("log")
   125     val PATH_LOG: Path = PATH + Path.explode("log")
   126     val PATH_DIFF: Path = PATH + Path.explode("diff")
   126     val PATH_DIFF: Path = PATH + Path.explode("diff")
   127     val PATH_STAT: Path = PATH + Path.explode("stat")
   127     val PATH_STAT: Path = PATH + Path.explode("stat")
   128 
   128 
       
   129     def ok(root: Path, ssh: SSH.System = SSH.Local): Boolean = ssh.is_dir(root + PATH)
       
   130 
   129     def check_directory(root: Path, ssh: SSH.System = SSH.Local): Unit =
   131     def check_directory(root: Path, ssh: SSH.System = SSH.Local): Unit =
   130       if (ssh.is_dir(root) && !ssh.is_dir(root + PATH) && ssh.read_dir(root).nonEmpty) {
   132       if (ssh.is_dir(root) && !ok(root, ssh = ssh) && ssh.read_dir(root).nonEmpty) {
   131         error("No .hg_sync meta data in " + ssh.rsync_path(root))
   133         error("No .hg_sync meta data in " + ssh.rsync_path(root))
   132       }
   134       }
   133 
   135 
   134     def directory(root: Path, ssh: SSH.System = SSH.Local): Directory = {
   136     def directory(root: Path, ssh: SSH.System = SSH.Local): Directory = {
   135       if (ssh.is_dir(root + PATH)) new Directory(root, ssh)
   137       if (ok(root, ssh = ssh)) new Directory(root, ssh)
   136       else error("No .hg_sync directory found in " + ssh.rsync_path(root))
   138       else error("No .hg_sync directory found in " + ssh.rsync_path(root))
   137     }
   139     }
   138 
   140 
   139     class Directory private [Hg_Sync](val root: Path, val ssh: SSH.System)
   141     class Directory private [Hg_Sync](val root: Path, val ssh: SSH.System)
   140     {
   142     {