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

Merge branch 'master' of github.com:facebook/phabricator

elynde 6fb24ba4 bd0a4c0d

+133 -284
+2
src/__phutil_library_map__.php
··· 88 88 'ConduitAPI_differential_parsecommitmessage_Method' => 'applications/conduit/method/differential/parsecommitmessage', 89 89 'ConduitAPI_differential_setdiffproperty_Method' => 'applications/conduit/method/differential/setdiffproperty', 90 90 'ConduitAPI_differential_updaterevision_Method' => 'applications/conduit/method/differential/updaterevision', 91 + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'applications/conduit/method/differential/updatetaskrevisionassoc', 91 92 'ConduitAPI_diffusion_getcommits_Method' => 'applications/conduit/method/diffusion/getcommits', 92 93 'ConduitAPI_file_upload_Method' => 'applications/conduit/method/file/upload', 93 94 'ConduitAPI_path_getowners_Method' => 'applications/conduit/method/path/getowners', ··· 540 541 'ConduitAPI_differential_parsecommitmessage_Method' => 'ConduitAPIMethod', 541 542 'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod', 542 543 'ConduitAPI_differential_updaterevision_Method' => 'ConduitAPIMethod', 544 + 'ConduitAPI_differential_updatetaskrevisionassoc_Method' => 'ConduitAPIMethod', 543 545 'ConduitAPI_diffusion_getcommits_Method' => 'ConduitAPIMethod', 544 546 'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod', 545 547 'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod',
+1 -1
src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php
··· 83 83 id(new AphrontFormTextControl()) 84 84 ->setLabel($param) 85 85 ->setName("params[{$param}]") 86 - ->setCaption($desc)); 86 + ->setCaption(phutil_escape_html($desc))); 87 87 } 88 88 89 89 $form
+9 -4
src/applications/conduit/method/differential/find/ConduitAPI_differential_find_Method.php
··· 34 34 35 35 return array( 36 36 'query' => 'required enum<'.$types.'>', 37 - 'guids' => 'required nonempty list<phid>', 37 + 'guids' => 'required nonempty list<guids>', 38 38 ); 39 39 } 40 40 ··· 49 49 50 50 protected function execute(ConduitAPIRequest $request) { 51 51 $query = $request->getValue('query'); 52 - $phids = $request->getValue('guids'); 52 + $guids = $request->getValue('guids'); 53 + 54 + $results = array(); 55 + if (!$guids) { 56 + return $results; 57 + } 53 58 54 59 $revisions = id(new DifferentialRevisionListData( 55 60 $query, 56 - (array)$phids)) 61 + (array)$guids)) 57 62 ->loadRevisions(); 58 63 59 - $results = array(); 60 64 foreach ($revisions as $revision) { 61 65 $diff = $revision->loadActiveDiff(); 62 66 if (!$diff) { ··· 64 68 } 65 69 $results[] = array( 66 70 'id' => $revision->getID(), 71 + 'phid' => $revision->getPHID(), 67 72 'name' => $revision->getTitle(), 68 73 'statusName' => DifferentialRevisionStatus::getNameForRevisionStatus( 69 74 $revision->getStatus()),
+71
src/applications/conduit/method/differential/updatetaskrevisionassoc/ConduitAPI_differential_updatetaskrevisionassoc_Method.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2011 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + class ConduitAPI_differential_updatetaskrevisionassoc_Method 20 + extends ConduitAPIMethod { 21 + public function getMethodDescription() { 22 + return "Given a task together with its original and new associated ". 23 + "revisions, update the revisions for their attached_tasks."; 24 + } 25 + 26 + public function defineParamTypes() { 27 + return array( 28 + 'task_phid' => 'required nonempty string', 29 + 'orig_rev_phids' => 'required list<string>', 30 + 'new_rev_phids' => 'required list<string>', 31 + ); 32 + } 33 + 34 + public function defineReturnType() { 35 + return 'void'; 36 + } 37 + 38 + public function defineErrorTypes() { 39 + return array( 40 + 'ERR_NO_TASKATTACHER_DEFINED' => 'No task attacher defined.', 41 + ); 42 + } 43 + 44 + protected function execute(ConduitAPIRequest $request) { 45 + $task_phid = $request->getValue('task_phid'); 46 + $orig_rev_phids = $request->getValue('orig_rev_phids'); 47 + if (empty($orig_rev_phids)) { 48 + $orig_rev_phids = array(); 49 + } 50 + 51 + $new_rev_phids = $request->getValue('new_rev_phids'); 52 + if (empty($new_rev_phids)) { 53 + $new_rev_phids = array(); 54 + } 55 + 56 + $task_class = PhabricatorEnv::getEnvConfig( 57 + 'differential.attach-task-class'); 58 + if (!$task_class) { 59 + throw new ConduitException('ERR_NO_TASKATTACHER_DEFINED'); 60 + } 61 + 62 + PhutilSymbolLoader::loadClass($task_class); 63 + $task_attacher = newv($task_class, array()); 64 + $task_attacher->updateTaskRevisionAssoc( 65 + $task_phid, 66 + $orig_rev_phids, 67 + $new_rev_phids); 68 + } 69 + 70 + } 71 +
+17
src/applications/conduit/method/differential/updatetaskrevisionassoc/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'applications/conduit/method/base'); 10 + phutil_require_module('phabricator', 'applications/conduit/protocol/exception'); 11 + phutil_require_module('phabricator', 'infrastructure/env'); 12 + 13 + phutil_require_module('phutil', 'symbols'); 14 + phutil_require_module('phutil', 'utils'); 15 + 16 + 17 + phutil_require_source('ConduitAPI_differential_updatetaskrevisionassoc_Method.php');
+14 -277
src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php
··· 157 157 $custom_renderer->generateActionLinks($revision, $target)); 158 158 } 159 159 160 + $whitespace = $request->getStr( 161 + 'whitespace', 162 + DifferentialChangesetParser::WHITESPACE_IGNORE_TRAILING 163 + ); 164 + 160 165 $revision_detail->setActions($actions); 161 166 162 167 $revision_detail->setUser($user); ··· 169 174 $comment_view->setUser($user); 170 175 $comment_view->setTargetDiff($target); 171 176 177 + $changeset_view = new DifferentialChangesetListView(); 178 + $changeset_view->setChangesets($visible_changesets); 179 + $changeset_view->setEditable(true); 180 + $changeset_view->setRevision($revision); 181 + $changeset_view->setVsMap($vs_map); 182 + $changeset_view->setWhitespace($whitespace); 183 + 172 184 $diff_history = new DifferentialRevisionUpdateHistoryView(); 173 185 $diff_history->setDiffs($diffs); 174 186 $diff_history->setSelectedVersusDiffID($diff_vs); 175 187 $diff_history->setSelectedDiffID($target->getID()); 176 - $diff_history->setSelectedWhitespace($request->getStr('whitespace')); 188 + $diff_history->setSelectedWhitespace($whitespace); 177 189 178 190 $toc_view = new DifferentialDiffTableOfContentsView(); 179 191 $toc_view->setChangesets($changesets); 180 192 $toc_view->setStandaloneViewLink(empty($visible_changesets)); 181 193 $toc_view->setVsMap($vs_map); 182 194 $toc_view->setRevisionID($revision->getID()); 195 + $toc_view->setWhitespace($whitespace); 183 196 184 - $changeset_view = new DifferentialChangesetListView(); 185 - $changeset_view->setChangesets($visible_changesets); 186 - $changeset_view->setEditable(true); 187 - $changeset_view->setRevision($revision); 188 - $changeset_view->setVsMap($vs_map); 189 - $changeset_view->setWhitespace($request->getStr('whitespace')); 190 197 191 198 $draft = id(new PhabricatorDraft())->loadOneWhere( 192 199 'authorPHID = %s AND draftKey = %s', ··· 604 611 ->replace(); 605 612 } 606 613 } 607 - /* 608 - 609 - 610 - protected function getSandcastleURI(Diff $diff) { 611 - $uri = $this->getDiffProperty($diff, 'facebook:sandcastle_uri'); 612 - if (!$uri) { 613 - $uri = $diff->getSandboxURL(); 614 - } 615 - return $uri; 616 - } 617 - 618 - protected function getDiffProperty(Diff $diff, $property, $default = null) { 619 - $diff_id = $diff->getID(); 620 - if (empty($this->diffProperties[$diff_id])) { 621 - $props = id(new DifferentialDiffProperty()) 622 - ->loadAllWhere('diffID = %s', $diff_id); 623 - $dict = array_pull($props, 'getData', 'getName'); 624 - $this->diffProperties[$diff_id] = $dict; 625 - } 626 - return idx($this->diffProperties[$diff_id], $property, $default); 627 - } 628 - 629 - $diff_table->appendChild( 630 - <tr> 631 - <td colspan="8" class="diff-differ-submit"> 632 - <label>Whitespace Changes:</label> 633 - {id(<select name="whitespace" />)->setOptions( 634 - array( 635 - 'ignore-all' => 'Ignore All', 636 - 'ignore-trailing' => 'Ignore Trailing', 637 - 'show-all' => 'Show All', 638 - ), $request->getStr('whitespace'))}{' '} 639 - <button type="submit">Show Diff</button> 640 - </td> 641 - </tr>); 642 - 643 - $load_ids = array_filter(array($old, $diff->getID())); 644 - 645 - $viewer_id = $this->getRequest()->getViewerContext()->getUserID(); 646 - 647 - $raw_objects = queryfx_all( 648 - smc_get_db('cdb.differential', 'r'), 649 - 'SELECT * FROM changeset WHERE changeset.diffID IN (%Ld)', 650 - $load_ids); 651 - 652 - $raw_objects = array_group($raw_objects, 'diffID'); 653 - $objects = $raw_objects[$diff->getID()]; 654 - 655 - if (!$objects) { 656 - $changesets = array(); 657 - } else { 658 - $changesets = id(new DifferentialChangeset())->loadAllFromArray($objects); 659 - } 660 - 661 - 662 - 663 - $feedback = id(new DifferentialFeedback())->loadAllWithRevision($revision); 664 - $feedback = array_merge($implied_feedback, $feedback); 665 - 666 - $inline_comments = $this->loadInlineComments($feedback, $changesets); 667 - 668 - $diff_map = array(); 669 - $diffs = array_psort($diffs, 'getID'); 670 - foreach ($diffs as $diff) { 671 - $diff_map[$diff->getID()] = count($diff_map) + 1; 672 - } 673 - $visible_changesets = array_fill_keys($visible_changesets, true); 674 - $hidden_changesets = array(); 675 - foreach ($changesets as $changeset) { 676 - $id = $changeset->getID(); 677 - if (isset($visible_changesets[$id])) { 678 - continue; 679 - } 680 - $hidden_changesets[$id] = $diff_map[$changeset->getDiffID()]; 681 - } 682 - 683 - 684 - $engine = new RemarkupEngine(); 685 - $engine->enableFeature(RemarkupEngine::FEATURE_GUESS_IMAGES); 686 - $engine->enableFeature(RemarkupEngine::FEATURE_YOUTUBE); 687 - $engine->setCurrentSandcastle($this->getSandcastleURI($target_diff)); 688 - 689 - $syntax_link = 690 - <a href={'http://www.intern.facebook.com/intern/wiki/index.php' . 691 - '/Articles/Remarkup_Syntax_Reference'} 692 - target="_blank" 693 - tabindex="4">Remarkup Reference</a>; 694 - 695 - 696 - $notice = null; 697 - if ($this->getRequest()->getBool('diff_changed')) { 698 - $notice = 699 - <tools:notice title="Revision Updated Recently"> 700 - This revision was updated with a <strong>new diff</strong> while you 701 - were providing feedback. Your inline comments appear on the 702 - <strong>old diff</strong>. 703 - </tools:notice>; 704 - } 705 - 706 - $engineering_repository_id = RepositoryRef::getByCallsign('E')->getID(); 707 - $svn_revision = $revision->getSVNRevision(); 708 - if ($status == DifferentialConstants::COMMITTED && 709 - $svn_revision && 710 - $revision->getRepositoryID() == $engineering_repository_id) { 711 - $href = '/intern/push/request.php?rev='.$svn_revision; 712 - $href = RedirectURI($href)->setTier('intern'); 713 - $links[] = array( 714 - 'merge', 715 - <a href={$href} id="ask_for_merge_link">Ask for Merge</a>, 716 - ); 717 - } 718 - 719 - } 720 - 721 - 722 - protected function renderDiffPropertyMoreLink(Diff $diff, $name) { 723 - $target = <div class="star-more" 724 - style="display: none;"> 725 - <div class="star-loading">Loading...</div> 726 - </div>; 727 - $meta = array( 728 - 'target' => $target->requireUniqueID(), 729 - 'uri' => '/differential/diffprop/'.$diff->getID().'/'.$name.'/', 730 - ); 731 - $more = 732 - <span sigil="star-link-container"> 733 - &middot; 734 - <a mustcapture="true" 735 - sigil="star-more" 736 - href="#" 737 - meta={$meta}>Show Details</a> 738 - </span>; 739 - return <x:frag>{$more}{$target}</x:frag>; 740 - } 741 - 742 - 743 - 744 - protected function getRevisionStatusDisplay(DifferentialRevision $revision) { 745 - $viewer_id = $this->getRequest()->getViewerContext()->getUserID(); 746 - $viewer_is_owner = ($viewer_id == $revision->getOwnerID()); 747 - $status = $revision->getStatus(); 748 - 749 - $more = null; 750 - switch ($status) { 751 - case DifferentialConstants::NEEDS_REVIEW: 752 - $message = 'Pending Review'; 753 - break; 754 - case DifferentialConstants::NEEDS_REVISION: 755 - $message = 'Awaiting Revision'; 756 - if ($viewer_is_owner) { 757 - $more = 'Make the requested changes and update the revision.'; 758 - } 759 - break; 760 - case DifferentialConstants::ACCEPTED: 761 - $message = 'Ready for Commit'; 762 - if ($viewer_is_owner) { 763 - $more = 764 - <x:frag> 765 - Run <tt>arc commit</tt> (svn) or <tt>arc amend</tt> (git) to 766 - proceed. 767 - </x:frag>; 768 - } 769 - break; 770 - case DifferentialConstants::COMMITTED: 771 - $message = 'Committed'; 772 - $ref = $revision->getRevisionRef(); 773 - $more = $ref 774 - ? (<a href={URI($ref->getDetailURL())}> 775 - {$ref->getName()} 776 - </a>) 777 - : null; 778 - 779 - $engineering_repository_id = RepositoryRef::getByCallsign('E')->getID(); 780 - if ($revision->getSVNRevision() && 781 - $revision->getRepositoryID() == $engineering_repository_id) { 782 - Javelin::initBehavior( 783 - 'differential-revtracker-status', 784 - array( 785 - 'uri' => '/differential/revtracker/'.$revision->getID().'/', 786 - 'statusId' => 'revtracker_status', 787 - 'mergeLinkId' => 'ask_for_merge_link', 788 - )); 789 - } 790 - break; 791 - case DifferentialConstants::ABANDONED: 792 - $message = 'Abandoned'; 793 - break; 794 - default: 795 - throw new Exception("Unknown revision status."); 796 - } 797 - 798 - if ($more) { 799 - $message = 800 - <x:frag> 801 - <strong id="revtracker_status">{$message}</strong> 802 - &middot; {$more} 803 - </x:frag>; 804 - } else { 805 - $message = <strong id="revtracker_status">{$message}</strong>; 806 - } 807 - 808 - return $message; 809 - } 810 - 811 - } 812 - protected function getDetailFields( 813 - DifferentialRevision $revision, 814 - Diff $diff, 815 - array $handles) { 816 - 817 - $sandcastle = $this->getSandcastleURI($diff); 818 - if ($sandcastle) { 819 - $fields['Sandcastle'] = <a href={$sandcastle}>{$sandcastle}</a>; 820 - } 821 - 822 - 823 - $blame_rev = $revision->getSvnBlameRevision(); 824 - if ($blame_rev) { 825 - if ($revision->getRepositoryRef() && is_numeric($blame_rev)) { 826 - $ref = new RevisionRef($revision->getRepositoryRef(), $blame_rev); 827 - $fields['Blame Revision'] = 828 - <a href={URI($ref->getDetailURL())}> 829 - {$ref->getName()} 830 - </a>; 831 - } else { 832 - $fields['Blame Revision'] = $blame_rev; 833 - } 834 - } 835 - 836 - 837 - $bugzilla_id = $revision->getBugzillaID(); 838 - if ($bugzilla_id) { 839 - $href = 'http://bugs.developers.facebook.com/show_bug.cgi?id='. 840 - $bugzilla_id; 841 - $fields['Bugzilla'] = <a href={$href}>{'#'.$bugzilla_id}</a>; 842 - } 843 - 844 - $fields['Apply Patch'] = <tt>arc patch --revision {$revision->getID()}</tt>; 845 - 846 - if ($diff->getParentRevisionID()) { 847 - $parent = id(new DifferentialRevision())->load( 848 - $diff->getParentRevisionID()); 849 - if ($parent) { 850 - $fields['Depends On'] = 851 - <a href={$parent->getURI()}> 852 - D{$parent->getID()}: {$parent->getName()} 853 - </a>; 854 - } 855 - } 856 - 857 - Javelin::initBehavior('differential-star-more'); 858 - if ($unit_details) { 859 - $fields['Unit Tests'] = 860 - <x:frag> 861 - {$fields['Unit Tests']} 862 - {$this->renderDiffPropertyMoreLink($diff, 'unit')} 863 - </x:frag>; 864 - } 865 - 866 - $platform_impact = $revision->getPlatformImpact(); 867 - if ($platform_impact) { 868 - $fields['Platform Impact'] = 869 - <text linebreaks="true">{$platform_impact}</text>; 870 - } 871 - 872 - return $fields; 873 - } 874 - 875 - 876 - */
+1
src/applications/differential/controller/revisionview/__init__.php
··· 10 10 phutil_require_module('phabricator', 'applications/differential/constants/action'); 11 11 phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus'); 12 12 phutil_require_module('phabricator', 'applications/differential/controller/base'); 13 + phutil_require_module('phabricator', 'applications/differential/parser/changeset'); 13 14 phutil_require_module('phabricator', 'applications/differential/storage/changeset'); 14 15 phutil_require_module('phabricator', 'applications/differential/storage/comment'); 15 16 phutil_require_module('phabricator', 'applications/differential/storage/diffproperty');
+11
src/applications/differential/tasks/DifferentialTasksAttacher.php
··· 26 26 $user_phid, 27 27 DifferentialRevision $revision, 28 28 array $task_ids); 29 + 30 + /** 31 + * This method will be called with a task and its original and new 32 + * associated revisions. Implementation of this method should update 33 + * the affected revisions to maintain the new associations. 34 + */ 35 + abstract public function updateTaskRevisionAssoc( 36 + $task_phid, 37 + array $orig_rev_phids, 38 + array $new_rev_phids); 39 + 29 40 }
+1 -1
src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
··· 23 23 private $revision; 24 24 private $renderURI = '/differential/changeset/'; 25 25 private $vsMap = array(); 26 - private $whitespace = null; 26 + private $whitespace; 27 27 28 28 public function setChangesets($changesets) { 29 29 $this->changesets = $changesets;
+6 -1
src/applications/differential/view/difftableofcontents/DifferentialDiffTableOfContentsView.php
··· 22 22 private $standaloneViewLink = null; 23 23 private $renderURI = '/differential/changeset/'; 24 24 private $revisionID; 25 + private $whitespace; 25 26 26 27 public function setChangesets($changesets) { 27 28 $this->changesets = $changesets; ··· 43 44 return $this; 44 45 } 45 46 47 + public function setWhitespace($whitespace) { 48 + $this->whitespace = $whitespace; 49 + return $this; 50 + } 46 51 47 52 public function render() { 48 53 ··· 95 100 array( 96 101 'id' => $ref, 97 102 'vs' => $vs_id, 98 - 'whitespace' => 'TODO', 103 + 'whitespace' => $this->whitespace, 99 104 'revision_id' => $this->revisionID, 100 105 )); 101 106