コード例 #1
0
ファイル: Svn.php プロジェクト: google-code-backups/xinc
 /**
  * Gets the modified files between two revisions from svn and puts this info
  * into the ModificationSet_Result.
  *
  * @param Xinc_Plugin_Repos_ModificationSet_Result $result The Result to get
  *  Hash ids from and set modified files.
  *
  * @return void
  * @throw Xinc_Exception_ModificationSet
  */
 protected function getModifiedFiles(Xinc_Plugin_Repos_ModificationSet_Result $result)
 {
     $arStatus = $this->svn->status->run(array($this->task->getDirectory()), array('u' => true));
     $arTarget = $arStatus['target'][0];
     $result->setBasePath($arTarget['path']);
     if (isset($arTarget['entry'])) {
         foreach ($arTarget['entry'] as $entry) {
             $strFileName = $entry['path'];
             $author = null;
             if (isset($entry['repos-status'])) {
                 $strReposStatus = $entry['repos-status']['item'];
             } else {
                 $strReposStatus = '';
             }
             switch ($strReposStatus) {
                 case 'modified':
                     $result->addUpdatedResource($strFileName, $author);
                     break;
                 case 'deleted':
                     $result->addDeletedResource($strFileName, $author);
                     break;
                 case 'added':
                     $result->addNewResource($strFileName, $author);
                     break;
                 case 'conflict':
                     $result->addConflictResource($strFileName, $author);
                     break;
             }
         }
     }
 }
コード例 #2
0
ファイル: Git.php プロジェクト: google-code-backups/xinc
 /**
  * Gets the modified files between two revisions from git and puts this info
  * into the ModificationSet_Result.
  *
  * @param Xinc_Plugin_Repos_ModificationSet_Result $result The Result to get
  *  Hash ids from and set modified files.
  *
  * @return void
  * @throw Xinc_Exception_ModificationSet
  */
 protected function getModifiedFiles(Xinc_Plugin_Repos_ModificationSet_Result $result)
 {
     $command = $this->git->getCommand('diff')->setOption('name-status')->addArgument($result->getLocalRevision() . '..' . $result->getRemoteRevision());
     try {
         $strResult = $command->execute();
     } catch (VersionControl_Git_Exception $e) {
         throw new Xinc_Exception_ModificationSet('GIT get version diff failed: ' . $e->getMessage(), 0, $e);
     }
     $arCommandLines = explode(PHP_EOL, trim($strResult));
     foreach ($arCommandLines as $strCommandLine) {
         // @TODO We need to diff from rev to rev so we can add Author Name.
         $strAuthor = null;
         list($strStatus, $strFile) = explode("\t", $strCommandLine);
         switch ($strStatus) {
             case 'M':
                 //Modified
             //Modified
             case 'R':
                 //Renamed
             //Renamed
             case 'T':
                 //Type changed
                 $result->addUpdatedResource($strFile, $strAuthor);
                 break;
             case 'D':
                 //Deleted
                 $result->addDeletedResource($strFile, $strAuthor);
                 break;
             case 'A':
                 //Added
             //Added
             case 'C':
                 //Copied
                 $result->addNewResource($strFile, $strAuthor);
                 break;
             case 'U':
                 // Unmerged
             // Unmerged
             case 'X':
                 // Unknown
             // Unknown
             case 'B':
                 // Broken pairing
             // Broken pairing
             default:
                 $result->addConflictResource($strFile, $strAuthor);
                 break;
         }
     }
 }