basic support for Mercurial command line tools;
authorwenzelm
Tue, 29 Apr 2014 15:24:41 +0200
changeset 56785 df03bf8c36a1
parent 56784 776890e0cf71
child 56786 13ede133f6eb
basic support for Mercurial command line tools;
src/Pure/System/isabelle_system.scala
--- a/src/Pure/System/isabelle_system.scala	Tue Apr 29 14:50:40 2014 +0200
+++ b/src/Pure/System/isabelle_system.scala	Tue Apr 29 15:24:41 2014 +0200
@@ -444,6 +444,7 @@
     def err: String = cat_lines(err_lines)
     def add_err(s: String): Bash_Result = copy(err_lines = err_lines ::: List(s))
     def set_rc(i: Int): Bash_Result = copy(rc = i)
+    def check_error: Bash_Result = if (rc != 0) error(err) else this
   }
 
   private class Limited_Progress(proc: Managed_Process, progress_limit: Option[Long])
@@ -514,6 +515,8 @@
   def pdf_viewer(arg: Path): Unit =
     bash("exec \"$PDF_VIEWER\" '" + standard_path(arg) + "' >/dev/null 2>/dev/null &")
 
+  def hg(cmd_line: String, cwd: Path = Path.current): Bash_Result =
+    bash("cd " + shell_path(cwd) + " && \"${HG:-hg}\" " + cmd_line)
 
 
   /** Isabelle resources **/