src/Pure/Tools/phabricator.scala
changeset 71311 e169a04e4d3b
parent 71310 fd644fb7871b
child 71314 5b68cc73f8b1
equal deleted inserted replaced
71310:fd644fb7871b 71311:e169a04e4d3b
   906               }
   906               }
   907             API.Repository(vcs, id, phid, name, callsign, short_name, importing, ssh_url)
   907             API.Repository(vcs, id, phid, name, callsign, short_name, importing, ssh_url)
   908           })))
   908           })))
   909     }
   909     }
   910 
   910 
       
   911     def the_repository(phid: String): API.Repository =
       
   912       get_repositories(phid = phid) match {
       
   913         case List(repo) => repo
       
   914         case _ => error("Bad repository " + quote(phid))
       
   915       }
       
   916 
   911     def create_repository(
   917     def create_repository(
   912       name: String,
   918       name: String,
   913       callsign: String = "",    // unique name, UPPERCASE
   919       callsign: String = "",    // unique name, UPPERCASE
   914       short_name: String = "",  // unique name
   920       short_name: String = "",  // unique name
   915       description: String = "",
   921       description: String = "",
   932         execute("diffusion.repository.edit", params = JSON.Object("transactions" -> transactions))
   938         execute("diffusion.repository.edit", params = JSON.Object("transactions" -> transactions))
   933           .get_value(JSON.value(_, "object", JSON.string(_, "phid")))
   939           .get_value(JSON.value(_, "object", JSON.string(_, "phid")))
   934 
   940 
   935       execute("diffusion.looksoon", params = JSON.Object("repositories" -> List(phid))).get
   941       execute("diffusion.looksoon", params = JSON.Object("repositories" -> List(phid))).get
   936 
   942 
   937       get_repositories(phid = phid) match {
   943       the_repository(phid)
   938         case List(repo) => repo
       
   939         case _ => error("Failed to access new repository: " + quote(phid))
       
   940       }
       
   941     }
   944     }
   942   }
   945   }
   943 
   946 
   944   object API
   947   object API
   945   {
   948   {