# HG changeset patch # User wenzelm # Date 1576682530 -3600 # Node ID 072e585ba2381cc8bb89b8cba70966f718d40ae7 # Parent 384755399fa88d79a796177039b43a30f98a1146 tuned; diff -r 384755399fa8 -r 072e585ba238 src/Pure/Tools/phabricator.scala --- a/src/Pure/Tools/phabricator.scala Wed Dec 18 16:14:54 2019 +0100 +++ b/src/Pure/Tools/phabricator.scala Wed Dec 18 16:22:10 2019 +0100 @@ -874,36 +874,6 @@ lazy val user_phid: String = execute("user.whoami").get_value(JSON.string(_, "phid")) lazy val user_name: String = execute("user.whoami").get_value(JSON.string(_, "userName")) - def create_repository( - name: String, - callsign: String = "", // unique name, UPPERCASE - short_name: String = "", // unique name - description: String = "", - public: Boolean = false, - vcs: API.VCS.Value = API.VCS.hg): String = - { - require(name.nonEmpty) - - val transactions = - API.edits("vcs", vcs.toString) ::: - API.edits("name", name) ::: - API.opt_edits("callsign", proper_string(callsign)) ::: - API.opt_edits("shortName", proper_string(short_name)) ::: - API.opt_edits("description", proper_string(description)) ::: - (if (public) Nil - else API.edits("view", user_phid) ::: API.edits("policy.push", user_phid)) ::: - API.edits("status", "active") - - val repo_phid = - execute("diffusion.repository.edit", params = JSON.Object("transactions" -> transactions)) - .get_value(JSON.value(_, "object", JSON.string(_, "phid"))) - - execute("diffusion.looksoon", - params = JSON.Object("repositories" -> List(repo_phid))).get - - repo_phid - } - def get_repositories( phid: String = "", callsign: String = "", short_name: String = ""): List[API.Repository] = { @@ -937,6 +907,36 @@ API.Repository(vcs, id, phid, name, callsign, short_name, importing, ssh_url) }))) } + + def create_repository( + name: String, + callsign: String = "", // unique name, UPPERCASE + short_name: String = "", // unique name + description: String = "", + public: Boolean = false, + vcs: API.VCS.Value = API.VCS.hg): String = + { + require(name.nonEmpty) + + val transactions = + API.edits("vcs", vcs.toString) ::: + API.edits("name", name) ::: + API.opt_edits("callsign", proper_string(callsign)) ::: + API.opt_edits("shortName", proper_string(short_name)) ::: + API.opt_edits("description", proper_string(description)) ::: + (if (public) Nil + else API.edits("view", user_phid) ::: API.edits("policy.push", user_phid)) ::: + API.edits("status", "active") + + val repo_phid = + execute("diffusion.repository.edit", params = JSON.Object("transactions" -> transactions)) + .get_value(JSON.value(_, "object", JSON.string(_, "phid"))) + + execute("diffusion.looksoon", + params = JSON.Object("repositories" -> List(repo_phid))).get + + repo_phid + } } object API