@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.

Provide detailed status information about repository state/progress

Summary:
Replace the blanket "daemons not running" warning with a lot more specific detail, to try to make it easier for users to figure out how to set up repositories correctly.

The next change here will add some additional status information from the daemons, so this panel can report results in greater detail.

Test Plan: See screenshots.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

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

+148 -13
+6
src/applications/diffusion/controller/DiffusionController.php
··· 96 96 } 97 97 } 98 98 99 + if (!$repository->isTracked()) { 100 + return new PhabricatorVCSResponse( 101 + 403, 102 + pht('This repository is inactive.')); 103 + } 104 + 99 105 $is_push = !$this->isReadOnlyRequest($repository); 100 106 101 107 switch ($repository->getServeOverHTTP()) {
+11 -5
src/applications/diffusion/controller/DiffusionRepositoryEditController.php
··· 3 3 abstract class DiffusionRepositoryEditController 4 4 extends DiffusionController { 5 5 6 - public function buildApplicationCrumbs() { 6 + public function buildApplicationCrumbs($is_main = false) { 7 7 $crumbs = parent::buildApplicationCrumbs(); 8 8 9 9 if ($this->diffusionRequest) { ··· 16 16 ->setName('r'.$repository->getCallsign()) 17 17 ->setHref($repo_uri)); 18 18 19 - $crumbs->addCrumb( 20 - id(new PhabricatorCrumbView()) 21 - ->setName(pht('Edit')) 22 - ->setHref($edit_uri)); 19 + if ($is_main) { 20 + $crumbs->addCrumb( 21 + id(new PhabricatorCrumbView()) 22 + ->setName(pht('Edit Repository'))); 23 + } else { 24 + $crumbs->addCrumb( 25 + id(new PhabricatorCrumbView()) 26 + ->setName(pht('Edit')) 27 + ->setHref($edit_uri)); 28 + } 23 29 } 24 30 25 31 return $crumbs;
+121 -8
src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
··· 19 19 $is_hg = false; 20 20 switch ($repository->getVersionControlSystem()) { 21 21 case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 22 - $has_local = true; 23 22 $is_git = true; 24 23 break; 25 24 case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 26 - $has_local = $repository->isHosted(); 27 25 $is_svn = true; 28 26 break; 29 27 case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 30 - $has_local = true; 31 28 $is_hg = true; 32 29 break; 33 30 } 34 31 35 32 $has_branches = ($is_git || $is_hg); 33 + $has_local = $repository->usesLocalWorkingCopy(); 36 34 37 - $crumbs = $this->buildApplicationCrumbs(); 35 + $crumbs = $this->buildApplicationCrumbs($is_main = true); 38 36 39 37 $title = pht('Edit %s', $repository->getName()); 40 38 ··· 199 197 ->setUser($viewer) 200 198 ->setActionList($actions); 201 199 202 - $view->addProperty(pht('Name'), $repository->getName()); 203 - $view->addProperty(pht('ID'), $repository->getID()); 204 - $view->addProperty(pht('PHID'), $repository->getPHID()); 205 - 206 200 $type = PhabricatorRepositoryType::getNameForRepositoryType( 207 201 $repository->getVersionControlSystem()); 208 202 209 203 $view->addProperty(pht('Type'), $type); 210 204 $view->addProperty(pht('Callsign'), $repository->getCallsign()); 205 + 206 + $view->addProperty( 207 + pht('Status'), 208 + $this->buildRepositoryStatus($repository)); 211 209 212 210 $description = $repository->getDetail('description'); 213 211 $view->addSectionHeader(pht('Description')); ··· 558 556 array(), 559 557 PhabricatorRepository::getProtocolAvailabilityName( 560 558 $repository->getServeOverSSH()))); 559 + 560 + return $view; 561 + } 562 + 563 + private function buildRepositoryStatus( 564 + PhabricatorRepository $repository) { 565 + 566 + $view = new PHUIStatusListView(); 567 + 568 + if ($repository->isTracked()) { 569 + $view->addItem( 570 + id(new PHUIStatusItemView()) 571 + ->setIcon('accept-green') 572 + ->setTarget(pht('Repository Active'))); 573 + } else { 574 + $view->addItem( 575 + id(new PHUIStatusItemView()) 576 + ->setIcon('warning') 577 + ->setTarget(pht('Repository Inactive')) 578 + ->setNote( 579 + pht('Activate this repository to begin or resume import.'))); 580 + return $view; 581 + } 582 + 583 + $doc_href = PhabricatorEnv::getDocLink( 584 + 'article/Managing_Daemons_with_phd.html'); 585 + $daemon_instructions = pht( 586 + 'Use %s to start daemons. See %s.', 587 + phutil_tag('tt', array(), 'bin/phd start'), 588 + phutil_tag( 589 + 'a', 590 + array( 591 + 'href' => $doc_href, 592 + ), 593 + pht('Managing Daemons with phd'))); 594 + 595 + 596 + $pull_daemon = id(new PhabricatorDaemonLogQuery()) 597 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 598 + ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) 599 + ->withDaemonClasses(array('PhabricatorRepositoryPullLocalDaemon')) 600 + ->setLimit(1) 601 + ->execute(); 602 + 603 + if ($pull_daemon) { 604 + $view->addItem( 605 + id(new PHUIStatusItemView()) 606 + ->setIcon('accept-green') 607 + ->setTarget(pht('Pull Daemon Running'))); 608 + } else { 609 + $view->addItem( 610 + id(new PHUIStatusItemView()) 611 + ->setIcon('warning-red') 612 + ->setTarget(pht('Pull Daemon Not Running')) 613 + ->setNote($daemon_instructions)); 614 + } 615 + 616 + 617 + $task_daemon = id(new PhabricatorDaemonLogQuery()) 618 + ->setViewer(PhabricatorUser::getOmnipotentUser()) 619 + ->withStatus(PhabricatorDaemonLogQuery::STATUS_ALIVE) 620 + ->withDaemonClasses(array('PhabricatorTaskmasterDaemon')) 621 + ->setLimit(1) 622 + ->execute(); 623 + if ($task_daemon) { 624 + $view->addItem( 625 + id(new PHUIStatusItemView()) 626 + ->setIcon('accept-green') 627 + ->setTarget(pht('Task Daemon Running'))); 628 + } else { 629 + $view->addItem( 630 + id(new PHUIStatusItemView()) 631 + ->setIcon('warning-red') 632 + ->setTarget(pht('Task Daemon Not Running')) 633 + ->setNote($daemon_instructions)); 634 + } 635 + 636 + $local_parent = dirname($repository->getLocalPath()); 637 + if (Filesystem::pathExists($local_parent)) { 638 + $view->addItem( 639 + id(new PHUIStatusItemView()) 640 + ->setIcon('accept-green') 641 + ->setTarget(pht('Storage Directory OK')) 642 + ->setNote(phutil_tag('tt', array(), $local_parent))); 643 + } else { 644 + $view->addItem( 645 + id(new PHUIStatusItemView()) 646 + ->setIcon('warning-red') 647 + ->setTarget(pht('No Storage Directory')) 648 + ->setNote( 649 + pht( 650 + 'Storage directory %s does not exist, or is not readable by '. 651 + 'the webserver. Create this directory or make it readable.', 652 + phutil_tag('tt', array(), $local_parent)))); 653 + return $view; 654 + } 655 + 656 + if ($repository->usesLocalWorkingCopy()) { 657 + $local_path = $repository->getLocalPath(); 658 + if (Filesystem::pathExists($local_path)) { 659 + $view->addItem( 660 + id(new PHUIStatusItemView()) 661 + ->setIcon('accept-green') 662 + ->setTarget(pht('Working Copy OK')) 663 + ->setNote(phutil_tag('tt', array(), $local_path))); 664 + } else { 665 + $view->addItem( 666 + id(new PHUIStatusItemView()) 667 + ->setIcon('time-orange') 668 + ->setTarget(pht('No Working Copy Yet')) 669 + ->setNote( 670 + pht('Waiting for daemons to build a working copy.'))); 671 + return $view; 672 + } 673 + } 561 674 562 675 return $view; 563 676 }
+10
src/applications/repository/storage/PhabricatorRepository.php
··· 805 805 } 806 806 } 807 807 808 + public function usesLocalWorkingCopy() { 809 + switch ($this->getVersionControlSystem()) { 810 + case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: 811 + return $this->isHosted(); 812 + case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: 813 + case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: 814 + return true; 815 + } 816 + } 817 + 808 818 809 819 /* -( PhabricatorPolicyInterface )----------------------------------------- */ 810 820