Example #1
0
 /**
  * Returns source url for merge.
  *
  * @param string $wc_path Working copy path.
  *
  * @return string
  * @throws CommandException When source path is invalid.
  */
 protected function getSourceUrl($wc_path)
 {
     $source_url = $this->io->getOption('source-url');
     if ($source_url === null) {
         $source_url = $this->getSetting(self::SETTING_MERGE_SOURCE_URL);
     }
     if (!$source_url) {
         $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path);
         $source_url = $this->_mergeSourceDetector->detect($wc_url);
         if ($source_url) {
             $this->setSetting(self::SETTING_MERGE_SOURCE_URL, $source_url);
         }
     }
     if (!$source_url) {
         $error_msg = 'Unable to determine source url for merge.' . PHP_EOL;
         $error_msg .= 'Please specify it manually using "--source-url" option';
         throw new CommandException($error_msg);
     }
     return $source_url;
 }
 /**
  * Returns source url for merge.
  *
  * @param string $wc_path Working copy path.
  *
  * @return string
  * @throws CommandException When source path is invalid.
  */
 protected function getSourceUrl($wc_path)
 {
     $source_url = $this->io->getOption('source-url');
     if ($source_url === null) {
         $source_url = $this->getSetting(self::SETTING_MERGE_SOURCE_URL);
     } elseif (!$this->repositoryConnector->isUrl($source_url)) {
         $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path);
         $source_url = $this->_urlResolver->resolve($wc_url, $source_url);
     }
     if (!$source_url) {
         $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path);
         $source_url = $this->_mergeSourceDetector->detect($wc_url);
         if ($source_url) {
             $this->setSetting(self::SETTING_MERGE_SOURCE_URL, $source_url);
         }
     }
     if (!$source_url) {
         $wc_url = $this->repositoryConnector->getWorkingCopyUrl($wc_path);
         $error_msg = 'Unable to guess "--source-url" option value. Please specify it manually.' . PHP_EOL;
         $error_msg .= 'Working Copy URL: ' . $wc_url . '.';
         throw new CommandException($error_msg);
     }
     return $source_url;
 }