Show more information on revision views
Summary: Show line count, arcanist project and base revision. This adds a little clutter but I think we're still okay and I can play around with it later. Test Plan: Looked at a couple of revisions. I'm actually not 100% sure about the SVN logic but maybe I will test that before committing. Reviewed By: tomo Reviewers: tomo, jungejason, tuomaspelkonen, aran CC: aran, tomo Differential Revision: 685
This commit is contained in:
		@@ -99,6 +99,10 @@ class DifferentialRevisionViewController extends DifferentialController {
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ($target->getArcanistProjectPHID()) {
 | 
			
		||||
      $object_phids[] = $target->getArcanistProjectPHID();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    foreach ($revision->getAttached() as $type => $phids) {
 | 
			
		||||
      foreach ($phids as $phid => $info) {
 | 
			
		||||
        $object_phids[] = $phid;
 | 
			
		||||
@@ -457,6 +461,13 @@ class DifferentialRevisionViewController extends DifferentialController {
 | 
			
		||||
      $properties['Commits'] = implode('<br />', $links);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $properties['Lines'] = number_format($diff->getLineCount());
 | 
			
		||||
    $arcanist_phid = $diff->getArcanistProjectPHID();
 | 
			
		||||
    if ($arcanist_phid) {
 | 
			
		||||
      $properties['Arcanist Project'] = phutil_escape_html(
 | 
			
		||||
        $handles[$arcanist_phid]->getName());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $properties['Apply Patch'] =
 | 
			
		||||
      '<tt>arc patch D'.$revision->getID().'</tt>';
 | 
			
		||||
    $properties['Export Patch'] =
 | 
			
		||||
 
 | 
			
		||||
@@ -75,6 +75,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
 | 
			
		||||
    $rows = array();
 | 
			
		||||
    $disable = false;
 | 
			
		||||
    $radios = array();
 | 
			
		||||
    $last_base = null;
 | 
			
		||||
    foreach ($data as $row) {
 | 
			
		||||
 | 
			
		||||
      $name = phutil_escape_html($row['name']);
 | 
			
		||||
@@ -123,7 +124,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
 | 
			
		||||
        $old = null;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      $desc = phutil_escape_html($row['desc']);
 | 
			
		||||
      $desc = $row['desc'];
 | 
			
		||||
 | 
			
		||||
      if ($row['age']) {
 | 
			
		||||
        $age = phabricator_format_timestamp($row['age']);
 | 
			
		||||
      } else {
 | 
			
		||||
@@ -144,11 +146,18 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
 | 
			
		||||
        $unit = null;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      $base = $this->renderBaseRevision($diff);
 | 
			
		||||
      if ($last_base !== null && $base !== $last_base) {
 | 
			
		||||
        // TODO: Render some kind of notice about rebases.
 | 
			
		||||
      }
 | 
			
		||||
      $last_base = $base;
 | 
			
		||||
 | 
			
		||||
      $rows[] =
 | 
			
		||||
        '<tr'.$class.'>'.
 | 
			
		||||
          '<td class="revhistory-name">'.$name.'</td>'.
 | 
			
		||||
          '<td class="revhistory-id">'.$id.'</td>'.
 | 
			
		||||
          '<td class="revhistory-desc">'.$desc.'</td>'.
 | 
			
		||||
          '<td class="revhistory-base">'.phutil_escape_html($base).'</td>'.
 | 
			
		||||
          '<td class="revhistory-desc">'.phutil_escape_html($desc).'</td>'.
 | 
			
		||||
          '<td class="revhistory-age">'.$age.'</td>'.
 | 
			
		||||
          '<td class="revhistory-star">'.$lint.'</td>'.
 | 
			
		||||
          '<td class="revhistory-star">'.$unit.'</td>'.
 | 
			
		||||
@@ -191,6 +200,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
 | 
			
		||||
            '<tr>'.
 | 
			
		||||
              '<th>Diff</th>'.
 | 
			
		||||
              '<th>ID</th>'.
 | 
			
		||||
              '<th>Base</th>'.
 | 
			
		||||
              '<th>Description</th>'.
 | 
			
		||||
              '<th>Created</th>'.
 | 
			
		||||
              '<th>Lint</th>'.
 | 
			
		||||
@@ -285,4 +295,17 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
 | 
			
		||||
      '</span>';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private function renderBaseRevision(DifferentialDiff $diff) {
 | 
			
		||||
    switch ($diff->getSourceControlSystem()) {
 | 
			
		||||
      case 'git':
 | 
			
		||||
        return substr($diff->getSourceControlBaseRevision(), 0, 7);
 | 
			
		||||
      case 'svn':
 | 
			
		||||
        $base = $diff->getSourceControlBaseRevision();
 | 
			
		||||
        $base = explode('@', $base);
 | 
			
		||||
        $base = end($base);
 | 
			
		||||
        return $base;
 | 
			
		||||
      default:
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,5 +33,6 @@ final class PhabricatorPHIDConstants {
 | 
			
		||||
  const PHID_TYPE_STRY    = 'STRY';
 | 
			
		||||
  const PHID_TYPE_POLL    = 'POLL';
 | 
			
		||||
  const PHID_TYPE_WIKI    = 'WIKI';
 | 
			
		||||
  const PHID_TYPE_APRJ    = 'APRJ';
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -345,6 +345,26 @@ class PhabricatorObjectHandleData {
 | 
			
		||||
            $handles[$phid] = $handle;
 | 
			
		||||
          }
 | 
			
		||||
          break;
 | 
			
		||||
        case PhabricatorPHIDConstants::PHID_TYPE_APRJ:
 | 
			
		||||
          $project_dao = newv('PhabricatorRepositoryArcanistProject', array());
 | 
			
		||||
 | 
			
		||||
          $projects = $project_dao->loadAllWhere(
 | 
			
		||||
            'phid IN (%Ls)',
 | 
			
		||||
            $phids);
 | 
			
		||||
          $projects = mpull($projects, null, 'getPHID');
 | 
			
		||||
          foreach ($phids as $phid) {
 | 
			
		||||
            $handle = new PhabricatorObjectHandle();
 | 
			
		||||
            $handle->setPHID($phid);
 | 
			
		||||
            $handle->setType($type);
 | 
			
		||||
            if (empty($projects[$phid])) {
 | 
			
		||||
              $handle->setName('Unknown Arcanist Project');
 | 
			
		||||
            } else {
 | 
			
		||||
              $project = $projects[$phid];
 | 
			
		||||
              $handle->setName($project->getName());
 | 
			
		||||
            }
 | 
			
		||||
            $handles[$phid] = $handle;
 | 
			
		||||
          }
 | 
			
		||||
          break;
 | 
			
		||||
        case PhabricatorPHIDConstants::PHID_TYPE_WIKI:
 | 
			
		||||
          $document_dao = newv('PhrictionDocument', array());
 | 
			
		||||
          $content_dao  = newv('PhrictionContent', array());
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user