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

Improve visibility of repository credential errors

Summary:
Fixes T7310. We have a whole mechanism for surfacing update errors, but only surface actual update errors, not pull errors.

Instead, surface pull errors too.

Then format them a little more nicely.

Test Plan: {F309769}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7310

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

+40 -16
+24 -1
src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
··· 963 963 if ($message) { 964 964 switch ($message->getStatusCode()) { 965 965 case PhabricatorRepositoryStatusMessage::CODE_ERROR: 966 + $message = $message->getParameter('message'); 967 + 968 + $suggestion = null; 969 + if (preg_match('/Permission denied \(publickey\)./', $message)) { 970 + $suggestion = pht( 971 + 'Public Key Error: This error usually indicates that the '. 972 + 'keypair you have configured does not have permission to '. 973 + 'access the repository.'); 974 + } 975 + 976 + $message = phutil_escape_html_newlines($message); 977 + 978 + if ($suggestion !== null) { 979 + $message = array( 980 + phutil_tag('strong', array(), $suggestion), 981 + phutil_tag('br'), 982 + phutil_tag('br'), 983 + phutil_tag('em', array(), pht('Raw Error')), 984 + phutil_tag('br'), 985 + $message, 986 + ); 987 + } 988 + 966 989 $view->addItem( 967 990 id(new PHUIStatusItemView()) 968 991 ->setIcon(PHUIStatusItemView::ICON_WARNING, 'red') 969 992 ->setTarget(pht('Update Error')) 970 - ->setNote($message->getParameter('message'))); 993 + ->setNote($message)); 971 994 return $view; 972 995 case PhabricatorRepositoryStatusMessage::CODE_OKAY: 973 996 $ago = (PhabricatorTime::getNow() - $message->getEpoch());
+16 -15
src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
··· 53 53 $repository = head($repos); 54 54 $callsign = $repository->getCallsign(); 55 55 56 - $no_discovery = $args->getArg('no-discovery'); 56 + try { 57 + $lock_name = get_class($this).':'.$callsign; 58 + $lock = PhabricatorGlobalLock::newLock($lock_name); 57 59 58 - id(new PhabricatorRepositoryPullEngine()) 59 - ->setRepository($repository) 60 - ->setVerbose($this->getVerbose()) 61 - ->pullRepository(); 60 + $lock->lock(); 62 61 63 - if ($no_discovery) { 64 - return; 65 - } 62 + $no_discovery = $args->getArg('no-discovery'); 66 63 67 - // TODO: It would be nice to discover only if we pulled something, but this 68 - // isn't totally trivial. It's slightly more complicated with hosted 69 - // repositories, too. 64 + id(new PhabricatorRepositoryPullEngine()) 65 + ->setRepository($repository) 66 + ->setVerbose($this->getVerbose()) 67 + ->pullRepository(); 70 68 71 - $lock_name = get_class($this).':'.$callsign; 72 - $lock = PhabricatorGlobalLock::newLock($lock_name); 69 + if ($no_discovery) { 70 + $lock->unlock(); 71 + return; 72 + } 73 73 74 - $lock->lock(); 74 + // TODO: It would be nice to discover only if we pulled something, but 75 + // this isn't totally trivial. It's slightly more complicated with hosted 76 + // repositories, too. 75 77 76 - try { 77 78 $repository->writeStatusMessage( 78 79 PhabricatorRepositoryStatusMessage::TYPE_NEEDS_UPDATE, 79 80 null);