src/Pure/Admin/isabelle_cronjob.scala
changeset 64154 e5cf40a54b1e
parent 64153 769791954872
child 64155 646c4d6a6a02
     1.1 --- a/src/Pure/Admin/isabelle_cronjob.scala	Tue Oct 11 21:48:56 2016 +0200
     1.2 +++ b/src/Pure/Admin/isabelle_cronjob.scala	Tue Oct 11 22:14:26 2016 +0200
     1.3 @@ -19,6 +19,18 @@
     1.4    val main_log = log_dir + Path.explode("main.log")
     1.5  
     1.6  
     1.7 +  /* managed repository clones */
     1.8 +
     1.9 +  val isabelle_repos = main_dir + Path.explode("isabelle-build_history")
    1.10 +  val afp_repos = main_dir + Path.explode("AFP-build_history")
    1.11 +
    1.12 +  def pull_repos(root: Path): String =
    1.13 +    using(Mercurial.open_repository(root))(hg =>
    1.14 +      {
    1.15 +        hg.pull(options = "-q")
    1.16 +        hg.identify("tip")
    1.17 +      })
    1.18 +
    1.19  
    1.20    /** cronjob **/
    1.21  
    1.22 @@ -53,6 +65,25 @@
    1.23      }
    1.24  
    1.25  
    1.26 +    /* identify repository snapshots */
    1.27 +
    1.28 +    {
    1.29 +      val pull_date = Date.now()
    1.30 +
    1.31 +      val isabelle_id = pull_repos(isabelle_repos)
    1.32 +      val afp_id = pull_repos(afp_repos)
    1.33 +
    1.34 +      val log_path = log_dir + Build_Log.log_path("isabelle_identify", pull_date)
    1.35 +      Isabelle_System.mkdirs(log_path.dir)
    1.36 +      File.write(log_path,
    1.37 +        Library.terminate_lines(
    1.38 +          List("isabelle_identify: " + Build_Log.Log_File.Date_Format(pull_date),
    1.39 +            "",
    1.40 +            "Isabelle version: " + isabelle_id,
    1.41 +            "AFP version: " + afp_id)))
    1.42 +    }
    1.43 +
    1.44 +
    1.45      /* end */
    1.46  
    1.47      val end_date = Date.now()