more robust command invocation, without defaults from hgrc;
authorwenzelm
Sun, 14 May 2017 16:54:03 +0200
changeset 65825 11f87ab51ddb
parent 65824 4ff79bd2b265
child 65826 0b8a6a62114f
more robust command invocation, without defaults from hgrc;
src/Pure/General/mercurial.scala
--- a/src/Pure/General/mercurial.scala	Sun May 14 15:58:07 2017 +0200
+++ b/src/Pure/General/mercurial.scala	Sun May 14 16:54:03 2017 +0200
@@ -96,7 +96,7 @@
     def command(name: String, args: String = "", options: String = ""): Process_Result =
     {
       val cmdline =
-        "\"${HG:-hg}\"" +
+        "\"${HG:-hg}\" --config " + Bash.string("defaults." + name + "=") +
           (if (name == "clone") "" else " --repository " + File.bash_path(root)) +
           " --noninteractive " + name + " " + options + " " + args
       ssh match {
@@ -139,21 +139,13 @@
     }
 
     def known_files(): List[String] =
-      hg.command("status", options = "--modified --added --clean --no-status --color=never").
-        check.out_lines
-
-    def length(): Int =
-      identify(options = "-n") match {
-        case Value.Int(n) => n + 1
-        case s => error("Cannot determine repository length from " + quote(s))
-      }
+      hg.command("status", options = "--modified --added --clean --no-status").check.out_lines
 
     def graph(): Graph[String, Unit] =
     {
       val Node = """^node: (\w{12}) (\w{12}) (\w{12})""".r
       val log_result =
-        log(template = """node: {node|short} {p1node|short} {p2node|short}\n""",
-          options = "-l " + length())
+        log(template = """node: {node|short} {p1node|short} {p2node|short}\n""")
       (Graph.string[Unit] /: split_lines(log_result)) {
         case (graph, Node(x, y, z)) =>
           val deps = List(y, z).filterNot(s => s.forall(_ == '0'))