private static function queryByPath($repo_callsign, $path)
 {
     $repository = id(new PhabricatorRepository())->loadOneWhere('callsign = %s', $repo_callsign);
     if (empty($repository)) {
         throw id(new ConduitException('ERR_REP_NOT_FOUND'))->setErrorDescription('Repository callsign ' . $repo_callsign . ' not recognized');
     }
     return PhabricatorOwnersPackage::loadOwningPackages($repository, $path);
 }
 private static function queryByPath(PhabricatorUser $viewer, $repo_callsign, $path)
 {
     $repository = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withCallsigns(array($repo_callsign))->executeOne();
     if (!$repository) {
         throw id(new ConduitException('ERR_REP_NOT_FOUND'))->setErrorDescription(pht('Repository callsign %s not recognized', $repo_callsign));
     }
     if ($path == null) {
         return PhabricatorOwnersPackage::loadPackagesForRepository($repository);
     } else {
         return PhabricatorOwnersPackage::loadOwningPackages($repository, $path);
     }
 }
 protected function execute(ConduitAPIRequest $request)
 {
     $repository = id(new PhabricatorRepository())->loadOneWhere('callsign = %s', $request->getValue('repositoryCallsign'));
     if (empty($repository)) {
         throw new ConduitException('ERR_REP_NOT_FOUND');
     }
     $packages = PhabricatorOwnersPackage::loadOwningPackages($repository, $request->getValue('path'));
     if (empty($packages)) {
         throw new ConduitException('ERR_PATH_NOT_FOUND');
     }
     $result = array();
     foreach ($packages as $package) {
         $p_owners = id(new PhabricatorOwnersOwner())->loadAllForPackages(array($package));
         $result[] = array('phid' => $package->getPHID(), 'name' => $package->getName(), 'primaryOwner' => $package->getPrimaryOwnerPHID(), 'owners' => array_values(mpull($p_owners, 'getUserPHID')));
     }
     return $result;
 }