@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a graph view page to Diffusion

Summary: Fixes T12840. This adds a parallel "graph" button next to history on home and on the history list page. I'll think more about better placement of how to get to this page with the upcoming redesign that's still sitting in Pholio.

Test Plan: View History, View Graph, Try pager, go to a file, click view history, see no graph button.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12840

Differential Revision: https://secure.phabricator.com/D18131

+161 -37
+2
src/__phutil_library_map__.php
··· 729 729 'DiffusionGitResponse' => 'applications/diffusion/response/DiffusionGitResponse.php', 730 730 'DiffusionGitSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitSSHWorkflow.php', 731 731 'DiffusionGitUploadPackSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitUploadPackSSHWorkflow.php', 732 + 'DiffusionGraphController' => 'applications/diffusion/controller/DiffusionGraphController.php', 732 733 'DiffusionHistoryController' => 'applications/diffusion/controller/DiffusionHistoryController.php', 733 734 'DiffusionHistoryListView' => 'applications/diffusion/view/DiffusionHistoryListView.php', 734 735 'DiffusionHistoryQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php', ··· 5706 5707 'DiffusionRepositoryClusterEngineLogInterface', 5707 5708 ), 5708 5709 'DiffusionGitUploadPackSSHWorkflow' => 'DiffusionGitSSHWorkflow', 5710 + 'DiffusionGraphController' => 'DiffusionController', 5709 5711 'DiffusionHistoryController' => 'DiffusionController', 5710 5712 'DiffusionHistoryListView' => 'DiffusionHistoryView', 5711 5713 'DiffusionHistoryQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
+1
src/applications/diffusion/application/PhabricatorDiffusionApplication.php
··· 56 56 'repository/(?P<dblob>.*)' => 'DiffusionRepositoryController', 57 57 'change/(?P<dblob>.*)' => 'DiffusionChangeController', 58 58 'history/(?P<dblob>.*)' => 'DiffusionHistoryController', 59 + 'graph/(?P<dblob>.*)' => 'DiffusionGraphController', 59 60 'browse/(?P<dblob>.*)' => 'DiffusionBrowseController', 60 61 'lastmodified/(?P<dblob>.*)' => 'DiffusionLastModifiedController', 61 62 'diff/' => 'DiffusionDiffController',
+3
src/applications/diffusion/controller/DiffusionController.php
··· 204 204 case 'history': 205 205 $view_name = pht('History'); 206 206 break; 207 + case 'graph': 208 + $view_name = pht('Graph'); 209 + break; 207 210 case 'browse': 208 211 $view_name = pht('Browse'); 209 212 break;
+108
src/applications/diffusion/controller/DiffusionGraphController.php
··· 1 + <?php 2 + 3 + final class DiffusionGraphController extends DiffusionController { 4 + 5 + public function shouldAllowPublic() { 6 + return true; 7 + } 8 + 9 + public function handleRequest(AphrontRequest $request) { 10 + $response = $this->loadDiffusionContext(); 11 + if ($response) { 12 + return $response; 13 + } 14 + 15 + $viewer = $this->getViewer(); 16 + $drequest = $this->getDiffusionRequest(); 17 + $repository = $drequest->getRepository(); 18 + 19 + $pager = id(new PHUIPagerView()) 20 + ->readFromRequest($request); 21 + 22 + $params = array( 23 + 'commit' => $drequest->getCommit(), 24 + 'path' => $drequest->getPath(), 25 + 'offset' => $pager->getOffset(), 26 + 'limit' => $pager->getPageSize() + 1, 27 + ); 28 + 29 + $history_results = $this->callConduitWithDiffusionRequest( 30 + 'diffusion.historyquery', 31 + $params); 32 + $history = DiffusionPathChange::newFromConduit( 33 + $history_results['pathChanges']); 34 + 35 + $history = $pager->sliceResults($history); 36 + 37 + $graph = id(new DiffusionHistoryTableView()) 38 + ->setViewer($viewer) 39 + ->setDiffusionRequest($drequest) 40 + ->setHistory($history); 41 + 42 + $graph->loadRevisions(); 43 + $show_graph = !strlen($drequest->getPath()); 44 + if ($show_graph) { 45 + $graph->setParents($history_results['parents']); 46 + $graph->setIsHead(!$pager->getOffset()); 47 + $graph->setIsTail(!$pager->getHasMorePages()); 48 + } 49 + 50 + $header = $this->buildHeader($drequest); 51 + 52 + $crumbs = $this->buildCrumbs( 53 + array( 54 + 'branch' => true, 55 + 'path' => true, 56 + 'view' => 'graph', 57 + )); 58 + $crumbs->setBorder(true); 59 + 60 + $title = array( 61 + pht('Graph'), 62 + $repository->getDisplayName(), 63 + ); 64 + 65 + $graph_view = id(new PHUIObjectBoxView()) 66 + ->setHeaderText(pht('History Graph')) 67 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 68 + ->setTable($graph) 69 + ->setPager($pager); 70 + 71 + $view = id(new PHUITwoColumnView()) 72 + ->setHeader($header) 73 + ->setFooter($graph_view); 74 + 75 + return $this->newPage() 76 + ->setTitle($title) 77 + ->setCrumbs($crumbs) 78 + ->appendChild($view); 79 + } 80 + 81 + private function buildHeader(DiffusionRequest $drequest) { 82 + $viewer = $this->getViewer(); 83 + 84 + $tag = $this->renderCommitHashTag($drequest); 85 + $history_uri = $drequest->generateURI( 86 + array( 87 + 'action' => 'history', 88 + )); 89 + 90 + $history_button = id(new PHUIButtonView()) 91 + ->setTag('a') 92 + ->setText(pht('History')) 93 + ->setHref($history_uri) 94 + ->setIcon('fa-history'); 95 + 96 + $header = id(new PHUIHeaderView()) 97 + ->setUser($viewer) 98 + ->setPolicyObject($drequest->getRepository()) 99 + ->addTag($tag) 100 + ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) 101 + ->setHeaderIcon('fa-code-fork') 102 + ->addActionLink($history_button); 103 + 104 + return $header; 105 + 106 + } 107 + 108 + }
+16 -12
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 77 77 $viewer = $this->getViewer(); 78 78 79 79 $tag = $this->renderCommitHashTag($drequest); 80 - $browse_uri = $drequest->generateURI( 81 - array( 82 - 'action' => 'browse', 83 - )); 84 - 85 - $browse_button = id(new PHUIButtonView()) 86 - ->setTag('a') 87 - ->setText(pht('Browse')) 88 - ->setHref($browse_uri) 89 - ->setIcon('fa-code'); 80 + $show_graph = !strlen($drequest->getPath()); 90 81 91 82 $header = id(new PHUIHeaderView()) 92 83 ->setUser($viewer) 93 84 ->setPolicyObject($drequest->getRepository()) 94 85 ->addTag($tag) 95 86 ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) 96 - ->setHeaderIcon('fa-clock-o') 97 - ->addActionLink($browse_button); 87 + ->setHeaderIcon('fa-clock-o'); 88 + 89 + if ($show_graph) { 90 + $graph_uri = $drequest->generateURI( 91 + array( 92 + 'action' => 'graph', 93 + )); 94 + 95 + $graph_button = id(new PHUIButtonView()) 96 + ->setTag('a') 97 + ->setText(pht('Graph')) 98 + ->setHref($graph_uri) 99 + ->setIcon('fa-code-fork'); 100 + $header->addActionLink($graph_button); 101 + } 98 102 99 103 return $header; 100 104
+29 -25
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 451 451 $header->setSubheader(pht('Showing %d branches.', $limit)); 452 452 } 453 453 454 - $button = new PHUIButtonView(); 455 - $button->setText(pht('Show All')); 456 - $button->setTag('a'); 457 - $button->setIcon('fa-code-fork'); 458 - $button->setHref($drequest->generateURI( 454 + $button = id(new PHUIButtonView()) 455 + ->setText(pht('Show All')) 456 + ->setTag('a') 457 + ->setIcon('fa-code-fork') 458 + ->setHref($drequest->generateURI( 459 459 array( 460 460 'action' => 'branches', 461 461 ))); ··· 511 511 pht('Showing the %d most recent tags.', $tag_limit)); 512 512 } 513 513 514 - $button = new PHUIButtonView(); 515 - $button->setText(pht('Show All Tags')); 516 - $button->setTag('a'); 517 - $button->setIcon('fa-tag'); 518 - $button->setHref($drequest->generateURI( 514 + $button = id(new PHUIButtonView()) 515 + ->setText(pht('Show All Tags')) 516 + ->setTag('a') 517 + ->setIcon('fa-tag') 518 + ->setHref($drequest->generateURI( 519 519 array( 520 520 'action' => 'tags', 521 521 ))); ··· 567 567 568 568 $history_table->setIsHead(true); 569 569 570 - $icon = id(new PHUIIconView()) 571 - ->setIcon('fa-list-alt'); 572 - 573 - $button = id(new PHUIButtonView()) 574 - ->setText(pht('View History')) 570 + $history = id(new PHUIButtonView()) 571 + ->setText(pht('History')) 575 572 ->setHref($drequest->generateURI( 576 573 array( 577 574 'action' => 'history', 578 575 ))) 579 576 ->setTag('a') 580 - ->setIcon($icon); 577 + ->setIcon('fa-history'); 578 + 579 + $graph = id(new PHUIButtonView()) 580 + ->setText(pht('Graph')) 581 + ->setHref($drequest->generateURI( 582 + array( 583 + 'action' => 'graph', 584 + ))) 585 + ->setTag('a') 586 + ->setIcon('fa-code-fork'); 581 587 582 588 $panel = id(new PHUIObjectBoxView()) 583 589 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); 584 590 $header = id(new PHUIHeaderView()) 585 591 ->setHeader(pht('Recent Commits')) 586 - ->addActionLink($button); 592 + ->addActionLink($graph) 593 + ->addActionLink($history); 587 594 $panel->setHeader($header); 588 595 $panel->setTable($history_table); 589 596 ··· 672 679 $header = id(new PHUIHeaderView()) 673 680 ->setHeader($repository->getName()); 674 681 675 - $icon = id(new PHUIIconView()) 676 - ->setIcon('fa-folder-open'); 677 - 678 - $button = new PHUIButtonView(); 679 - $button->setText(pht('Browse Repository')); 680 - $button->setTag('a'); 681 - $button->setIcon($icon); 682 - $button->setHref($browse_uri); 682 + $button = id(new PHUIButtonView()) 683 + ->setText(pht('Browse')) 684 + ->setTag('a') 685 + ->setIcon('fa-code') 686 + ->setHref($browse_uri); 683 687 684 688 $header->addActionLink($button); 685 689 $browse_panel->setHeader($header);
+2
src/applications/repository/storage/PhabricatorRepository.php
··· 699 699 $action = idx($params, 'action'); 700 700 switch ($action) { 701 701 case 'history': 702 + case 'graph': 702 703 case 'browse': 703 704 case 'change': 704 705 case 'lastmodified': ··· 776 777 switch ($action) { 777 778 case 'change': 778 779 case 'history': 780 + case 'graph': 779 781 case 'browse': 780 782 case 'lastmodified': 781 783 case 'tags':