equal
deleted
inserted
replaced
|
1 /* Title: Pure/General/mercurial.scala |
|
2 Author: Makarius |
|
3 |
|
4 Support for Mercurial repositories. |
|
5 */ |
|
6 |
|
7 package isabelle |
|
8 |
|
9 |
|
10 import java.io.{File => JFile} |
|
11 |
|
12 |
|
13 object Mercurial |
|
14 { |
|
15 /* command-line syntax */ |
|
16 |
|
17 def opt_rev(rev: String): String = if (rev == "") "" else " --rev " + File.bash_string(rev) |
|
18 |
|
19 |
|
20 /* repository access */ |
|
21 |
|
22 def open_repository(root: Path): Repository = new Repository(root) |
|
23 |
|
24 class Repository private[Mercurial](val root: Path) |
|
25 { |
|
26 override def toString: String = root.toString |
|
27 |
|
28 def close() { } |
|
29 |
|
30 def command(cmd: String, cwd: JFile = null): Process_Result = |
|
31 Isabelle_System.hg("--repository " + File.bash_path(root) + " " + cmd, cwd = cwd) |
|
32 |
|
33 def manifest(rev: String = "", cwd: JFile = null): List[String] = |
|
34 command("manifest" + opt_rev(rev), cwd = cwd).check.out_lines |
|
35 |
|
36 command("root").check |
|
37 } |
|
38 } |