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

Modernize Releeph branch edit and create interfaces

Summary: Ref T3092. Fixes T3724. Use modern/flexible UI for these interfaces. Removes the ability to retarget an existing branch (you can just close it and open a new one if you made a mistake).

Test Plan: {F54437} {F54438}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3092, T3724

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

+75 -84
+27
src/applications/releeph/controller/ReleephProjectController.php
··· 106 106 return $this->releephRequest; 107 107 } 108 108 109 + protected function buildApplicationCrumbs() { 110 + $crumbs = parent::buildApplicationCrumbs(); 111 + 112 + $project = $this->getReleephProject(); 113 + $project_id = $project->getID(); 114 + $project_uri = $this->getApplicationURI("project/{$project_id}/"); 115 + 116 + $crumbs->addCrumb( 117 + id(new PhabricatorCrumbView()) 118 + ->setHref($project_uri) 119 + ->setName($project->getName())); 120 + 121 + try { 122 + $branch = $this->getReleephBranch(); 123 + $branch_uri = $branch->getURI(); 124 + $crumbs->addCrumb( 125 + id(new PhabricatorCrumbView()) 126 + ->setHref($branch_uri) 127 + ->setName($branch->getDisplayNameWithDetail())); 128 + } catch (Exception $ex) { 129 + // TODO: This is kind of derps. 130 + } 131 + 132 + return $crumbs; 133 + } 134 + 135 + 109 136 }
+19 -8
src/applications/releeph/controller/branch/ReleephBranchCreateController.php
··· 71 71 $error_view->setTitle(pht('Form Errors')); 72 72 } 73 73 74 + $project_id = $releeph_project->getID(); 75 + $project_uri = $this->getApplicationURI("project/{$project_id}/"); 76 + 74 77 $form = id(new AphrontFormView()) 75 78 ->setUser($request->getUser()) 76 79 ->appendChild( ··· 93 96 ->appendChild( 94 97 id(new AphrontFormSubmitControl()) 95 98 ->setValue(pht('Cut Branch')) 96 - ->addCancelButton($releeph_project->getURI())); 99 + ->addCancelButton($project_uri)); 97 100 98 - $panel = id(new AphrontPanelView()) 99 - ->appendChild($form) 100 - ->setHeader(pht('Cut Branch')) 101 - ->setWidth(AphrontPanelView::WIDTH_FORM); 101 + $crumbs = $this->buildApplicationCrumbs(); 102 + $crumbs->addCrumb( 103 + id(new PhabricatorCrumbView()) 104 + ->setName(pht('New Branch'))); 102 105 103 - return $this->buildStandardPageResponse( 104 - array($error_view, $panel), 105 - array('title' => pht('Cut new branch'))); 106 + return $this->buildApplicationPage( 107 + array( 108 + $crumbs, 109 + $error_view, 110 + $form, 111 + ), 112 + array( 113 + 'title' => pht('New Branch'), 114 + 'device' => true, 115 + 'dust' => true, 116 + )); 106 117 } 107 118 }
+28 -61
src/applications/releeph/controller/branch/ReleephBranchEditController.php
··· 5 5 public function processRequest() { 6 6 $request = $this->getRequest(); 7 7 $releeph_branch = $this->getReleephBranch(); 8 - $branch_name = $request->getStr( 9 - 'branchName', 10 - $releeph_branch->getName()); 11 8 $symbolic_name = $request->getStr( 12 9 'symbolicName', 13 10 $releeph_branch->getSymbolicName()); 14 11 15 - $e_existing_with_same_branch_name = false; 16 12 $errors = array(); 17 13 18 14 if ($request->isFormPost()) { 19 - $existing_with_same_branch_name = 15 + $existing_with_same_symbolic_name = 20 16 id(new ReleephBranch()) 21 17 ->loadOneWhere( 22 - 'id != %d AND releephProjectID = %d AND name = %s', 18 + 'id != %d AND releephProjectID = %d AND symbolicName = %s', 23 19 $releeph_branch->getID(), 24 20 $releeph_branch->getReleephProjectID(), 25 - $branch_name); 21 + $symbolic_name); 22 + 23 + $releeph_branch->openTransaction(); 24 + $releeph_branch 25 + ->setSymbolicName($symbolic_name); 26 26 27 - if ($existing_with_same_branch_name) { 28 - $errors[] = pht( 29 - "The branch name %s is currently taken. Please use another name. ", 30 - $branch_name); 31 - $e_existing_with_same_branch_name = pht('Error'); 27 + if ($existing_with_same_symbolic_name) { 28 + $existing_with_same_symbolic_name 29 + ->setSymbolicName(null) 30 + ->save(); 32 31 } 33 32 34 - if (!$errors) { 35 - $existing_with_same_symbolic_name = 36 - id(new ReleephBranch()) 37 - ->loadOneWhere( 38 - 'id != %d AND releephProjectID = %d AND symbolicName = %s', 39 - $releeph_branch->getID(), 40 - $releeph_branch->getReleephProjectID(), 41 - $symbolic_name); 42 - 43 - $releeph_branch->openTransaction(); 44 - $releeph_branch 45 - ->setName($branch_name) 46 - ->setBasename(last(explode('/', $branch_name))) 47 - ->setSymbolicName($symbolic_name); 33 + $releeph_branch->save(); 34 + $releeph_branch->saveTransaction(); 48 35 49 - if ($existing_with_same_symbolic_name) { 50 - $existing_with_same_symbolic_name 51 - ->setSymbolicName(null) 52 - ->save(); 53 - } 54 - 55 - $releeph_branch->save(); 56 - $releeph_branch->saveTransaction(); 57 - 58 - return id(new AphrontRedirectResponse()) 59 - ->setURI('/releeph/project/'.$releeph_branch->getReleephProjectID()); 60 - } 36 + return id(new AphrontRedirectResponse()) 37 + ->setURI('/releeph/project/'.$releeph_branch->getReleephProjectID()); 61 38 } 62 39 63 40 $phids = array(); ··· 74 51 ->appendChild( 75 52 id(new AphrontFormStaticControl()) 76 53 ->setLabel(pht('Branch Name')) 77 - ->setValue($branch_name)) 54 + ->setValue($releeph_branch->getName())) 78 55 ->appendChild( 79 56 id(new AphrontFormMarkupControl()) 80 57 ->setLabel(pht('Cut Point')) ··· 90 67 ->setValue($symbolic_name) 91 68 ->setCaption(pht('Mutable alternate name, for easy reference, '. 92 69 '(e.g. "LATEST")'))) 93 - ->appendChild(phutil_tag( 94 - 'p', 95 - array(), 96 - pht('In dire situations where the branch name is wrong, ' . 97 - 'you can edit it in the database by changing the field below. ' . 98 - 'If you do this, it is very important that you change your ' . 99 - 'branch\'s name in the VCS to reflect the new name in Releeph, ' . 100 - 'otherwise a catastrophe of previously unheard-of magnitude ' . 101 - 'will befall your project.'))) 102 - ->appendChild( 103 - id(new AphrontFormTextControl) 104 - ->setLabel(pht('New Branch Name')) 105 - ->setName('branchName') 106 - ->setValue($branch_name) 107 - ->setError($e_existing_with_same_branch_name)) 108 70 ->appendChild( 109 71 id(new AphrontFormSubmitControl()) 110 72 ->addCancelButton($releeph_branch->getURI()) ··· 122 84 'Edit Branch %s', 123 85 $releeph_branch->getDisplayNameWithDetail()); 124 86 125 - $panel = id(new AphrontPanelView()) 126 - ->setHeader($title) 127 - ->appendChild($form) 128 - ->setWidth(AphrontPanelView::WIDTH_FORM); 87 + $crumbs = $this->buildApplicationCrumbs(); 88 + $crumbs->addCrumb( 89 + id(new PhabricatorCrumbView()) 90 + ->setName(pht('Edit'))); 129 91 130 - return $this->buildStandardPageResponse( 92 + return $this->buildApplicationPage( 131 93 array( 94 + $crumbs, 132 95 $error_view, 133 - $panel, 96 + $form, 134 97 ), 135 - array('title' => $title)); 98 + array( 99 + 'title' => $title, 100 + 'device' => true, 101 + 'dust' => true, 102 + )); 136 103 } 137 104 }
+1 -10
src/applications/releeph/controller/branch/ReleephBranchViewController.php
··· 76 76 77 77 public function buildApplicationCrumbs() { 78 78 $releeph_branch = $this->getReleephBranch(); 79 - $releeph_project = $this->getReleephProject(); 80 79 81 - $crumbs = parent::buildApplicationCrumbs() 82 - ->addCrumb( 83 - id(new PhabricatorCrumbView()) 84 - ->setName($releeph_project->getName()) 85 - ->setHref($releeph_project->getURI())) 86 - ->addCrumb( 87 - id(new PhabricatorCrumbView()) 88 - ->setName($releeph_branch->getDisplayNameWithDetail()) 89 - ->setHref($releeph_branch->getURI())); 80 + $crumbs = parent::buildApplicationCrumbs(); 90 81 91 82 if ($releeph_branch->isActive()) { 92 83 $create_uri = $releeph_branch->getURI('request/');
-1
src/applications/releeph/controller/project/ReleephProjectListController.php
··· 101 101 return $crumbs; 102 102 } 103 103 104 - 105 104 }
-4
src/applications/releeph/controller/project/ReleephProjectViewController.php
··· 156 156 157 157 $project = $this->getReleephProject(); 158 158 159 - $crumbs->addCrumb( 160 - id(new PhabricatorCrumbView()) 161 - ->setName($project->getName())); 162 - 163 159 $crumbs->addAction( 164 160 id(new PHUIListItemView()) 165 161 ->setHref($project->getURI('cutbranch'))