diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 9ddfbbe0..7bf922b9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -168,8 +168,6 @@ phutil_register_library_map(array( 'ArcanistDifferentialDependencyGraph' => 'differential/ArcanistDifferentialDependencyGraph.php', 'ArcanistDifferentialRevisionHash' => 'differential/constants/ArcanistDifferentialRevisionHash.php', 'ArcanistDifferentialRevisionStatus' => 'differential/constants/ArcanistDifferentialRevisionStatus.php', - 'ArcanistDisplayRef' => 'ref/ArcanistDisplayRef.php', - 'ArcanistDisplayRefInterface' => 'ref/ArcanistDisplayRefInterface.php', 'ArcanistDoubleQuoteXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistDoubleQuoteXHPASTLinterRule.php', 'ArcanistDoubleQuoteXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistDoubleQuoteXHPASTLinterRuleTestCase.php', 'ArcanistDownloadWorkflow' => 'workflow/ArcanistDownloadWorkflow.php', @@ -415,6 +413,7 @@ phutil_register_library_map(array( 'ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase.php', 'ArcanistRef' => 'ref/ArcanistRef.php', 'ArcanistRefInspector' => 'inspector/ArcanistRefInspector.php', + 'ArcanistRefView' => 'ref/ArcanistRefView.php', 'ArcanistRemoteRef' => 'repository/remote/ArcanistRemoteRef.php', 'ArcanistRepositoryAPI' => 'repository/api/ArcanistRepositoryAPI.php', 'ArcanistRepositoryAPIMiscTestCase' => 'repository/api/__tests__/ArcanistRepositoryAPIMiscTestCase.php', @@ -1084,21 +1083,12 @@ phutil_register_library_map(array( 'ArcanistBrowseURIRef' => 'ArcanistRef', 'ArcanistBrowseWorkflow' => 'ArcanistArcWorkflow', 'ArcanistBuildBuildplanHardpointQuery' => 'ArcanistRuntimeHardpointQuery', - 'ArcanistBuildPlanRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistBuildPlanRef' => 'ArcanistRef', 'ArcanistBuildPlanSymbolRef' => 'ArcanistSimpleSymbolRef', - 'ArcanistBuildRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistBuildRef' => 'ArcanistRef', 'ArcanistBuildSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistBuildableBuildsHardpointQuery' => 'ArcanistRuntimeHardpointQuery', - 'ArcanistBuildableRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistBuildableRef' => 'ArcanistRef', 'ArcanistBuildableSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistBundle' => 'Phobject', 'ArcanistBundleTestCase' => 'PhutilTestCase', @@ -1196,10 +1186,6 @@ phutil_register_library_map(array( 'ArcanistDifferentialDependencyGraph' => 'AbstractDirectedGraph', 'ArcanistDifferentialRevisionHash' => 'Phobject', 'ArcanistDifferentialRevisionStatus' => 'Phobject', - 'ArcanistDisplayRef' => array( - 'Phobject', - 'ArcanistTerminalStringInterface', - ), 'ArcanistDoubleQuoteXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistDoubleQuoteXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistDownloadWorkflow' => 'ArcanistArcWorkflow', @@ -1224,10 +1210,7 @@ phutil_register_library_map(array( 'ArcanistExtractUseXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistFileConfigurationSource' => 'ArcanistFilesystemConfigurationSource', 'ArcanistFileDataRef' => 'Phobject', - 'ArcanistFileRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistFileRef' => 'ArcanistRef', 'ArcanistFileSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistFileUploader' => 'Phobject', 'ArcanistFilenameLinter' => 'ArcanistLinter', @@ -1357,10 +1340,7 @@ phutil_register_library_map(array( 'ArcanistLogicalOperatorsXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistLowercaseFunctionsXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistLowercaseFunctionsXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', - 'ArcanistMarkerRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistMarkerRef' => 'ArcanistRef', 'ArcanistMarkersWorkflow' => 'ArcanistArcWorkflow', 'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI', 'ArcanistMercurialCommitMessageHardpointQuery' => 'ArcanistWorkflowMercurialHardpointQuery', @@ -1420,10 +1400,7 @@ phutil_register_library_map(array( 'ArcanistParenthesesSpacingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistParseStrUseXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistParseStrUseXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', - 'ArcanistPasteRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistPasteRef' => 'ArcanistRef', 'ArcanistPasteSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistPasteWorkflow' => 'ArcanistArcWorkflow', 'ArcanistPatchWorkflow' => 'ArcanistWorkflow', @@ -1454,6 +1431,10 @@ phutil_register_library_map(array( 'ArcanistRaggedClassTreeEdgeXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistRef' => 'ArcanistHardpointObject', 'ArcanistRefInspector' => 'Phobject', + 'ArcanistRefView' => array( + 'Phobject', + 'ArcanistTerminalStringInterface', + ), 'ArcanistRemoteRef' => 'ArcanistRef', 'ArcanistRepositoryAPI' => 'Phobject', 'ArcanistRepositoryAPIMiscTestCase' => 'PhutilTestCase', @@ -1473,10 +1454,7 @@ phutil_register_library_map(array( 'ArcanistRevisionBuildableHardpointQuery' => 'ArcanistRuntimeHardpointQuery', 'ArcanistRevisionCommitMessageHardpointQuery' => 'ArcanistRuntimeHardpointQuery', 'ArcanistRevisionParentRevisionsHardpointQuery' => 'ArcanistRuntimeHardpointQuery', - 'ArcanistRevisionRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistRevisionRef' => 'ArcanistRef', 'ArcanistRevisionRefSource' => 'Phobject', 'ArcanistRevisionSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistRuboCopLinter' => 'ArcanistExternalLinter', @@ -1517,10 +1495,7 @@ phutil_register_library_map(array( 'ArcanistSymbolRef' => 'ArcanistRef', 'ArcanistSyntaxErrorXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', 'ArcanistSystemConfigurationSource' => 'ArcanistFilesystemConfigurationSource', - 'ArcanistTaskRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistTaskRef' => 'ArcanistRef', 'ArcanistTaskSymbolRef' => 'ArcanistSimpleSymbolRef', 'ArcanistTasksWorkflow' => 'ArcanistWorkflow', 'ArcanistTautologicalExpressionXHPASTLinterRule' => 'ArcanistXHPASTLinterRule', @@ -1570,10 +1545,7 @@ phutil_register_library_map(array( 'ArcanistUselessOverridingMethodXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase', 'ArcanistUserAbortException' => 'ArcanistUsageException', 'ArcanistUserConfigurationSource' => 'ArcanistFilesystemConfigurationSource', - 'ArcanistUserRef' => array( - 'ArcanistRef', - 'ArcanistDisplayRefInterface', - ), + 'ArcanistUserRef' => 'ArcanistRef', 'ArcanistUserSymbolHardpointQuery' => 'ArcanistRuntimeHardpointQuery', 'ArcanistUserSymbolRef' => 'ArcanistSymbolRef', 'ArcanistUserSymbolRefInspector' => 'ArcanistRefInspector', diff --git a/src/land/engine/ArcanistLandEngine.php b/src/land/engine/ArcanistLandEngine.php index 29365a9d..d02eec5a 100644 --- a/src/land/engine/ArcanistLandEngine.php +++ b/src/land/engine/ArcanistLandEngine.php @@ -305,7 +305,7 @@ abstract class ArcanistLandEngine $viewer->getMonogram())); foreach ($unauthored as $revision_ref) { - $display_ref = $revision_ref->newDisplayRef(); + $display_ref = $revision_ref->newRefView(); $author_ref = $revision_ref->getAuthorRef(); if ($author_ref) { @@ -373,7 +373,7 @@ abstract class ArcanistLandEngine phutil_count($planned))); foreach ($planned as $revision_ref) { - echo tsprintf('%s', $revision_ref->newDisplayRef()); + echo tsprintf('%s', $revision_ref->newRefView()); } $query = pht( @@ -402,7 +402,7 @@ abstract class ArcanistLandEngine $example_ref->getStatusDisplayName())); foreach ($published as $revision_ref) { - echo tsprintf('%s', $revision_ref->newDisplayRef()); + echo tsprintf('%s', $revision_ref->newRefView()); } $query = pht( @@ -429,7 +429,7 @@ abstract class ArcanistLandEngine phutil_count($not_accepted))); foreach ($not_accepted as $revision_ref) { - $display_ref = $revision_ref->newDisplayRef(); + $display_ref = $revision_ref->newRefView(); $display_ref->appendLine( pht( 'Status: %s', @@ -493,7 +493,7 @@ abstract class ArcanistLandEngine foreach ($open_parents as $parent_phid => $spec) { $parent_ref = $spec['ref']; - $display_ref = $parent_ref->newDisplayRef(); + $display_ref = $parent_ref->newRefView(); $display_ref->appendLine( pht( @@ -686,38 +686,31 @@ abstract class ArcanistLandEngine $prompt_key = 'arc.land.ongoing-builds'; } + $workflow = $this->getWorkflow(); + echo tsprintf("\n"); foreach ($build_map as $build_item) { $revision_ref = $build_item['revisionRef']; + $revision_view = $revision_ref->newRefView(); - echo tsprintf('%s', $revision_ref->newDisplayRef()); + $buildable_ref = $revision_ref->getBuildableRef(); + $buildable_view = $buildable_ref->newRefView(); + + $raw_uri = $buildable_ref->getURI(); + $raw_uri = $workflow->getAbsoluteURI($raw_uri); + $buildable_view->setURI($raw_uri); + + $revision_view->addChild($buildable_view); foreach ($build_item['buildRefs'] as $build_ref) { - echo tsprintf('%s', $build_ref->newDisplayRef()); + $build_view = $build_ref->newRefView(); + $buildable_view->addChild($build_view); } + echo tsprintf('%s', $revision_view); echo tsprintf("\n"); } - echo tsprintf( - "\n%s\n", - pht('You can review build details here:')); - - // TODO: Only show buildables with problem builds. - - $workflow = $this->getWorkflow(); - - foreach ($buildable_refs as $buildable) { - $display_ref = $buildable->newDisplayRef(); - - $raw_uri = $buildable->getURI(); - $raw_uri = $workflow->getAbsoluteURI($raw_uri); - - $display_ref->setURI($raw_uri); - - echo tsprintf('%s', $display_ref); - } - $this->getWorkflow() ->getPrompt($prompt_key) ->setQuery($query) @@ -777,7 +770,7 @@ abstract class ArcanistLandEngine echo tsprintf( "\n%s", - $revision_ref->newDisplayRef()); + $revision_ref->newRefView()); foreach ($set->getCommits() as $commit) { $is_implicit = $commit->getIsImplicitCommit(); @@ -969,7 +962,7 @@ abstract class ArcanistLandEngine foreach ($revision_refs as $revision_ref) { echo tsprintf( '%s', - $revision_ref->newDisplayRef()); + $revision_ref->newRefView()); } echo tsprintf("\n"); diff --git a/src/land/engine/ArcanistMercurialLandEngine.php b/src/land/engine/ArcanistMercurialLandEngine.php index eeba0122..25b49929 100644 --- a/src/land/engine/ArcanistMercurialLandEngine.php +++ b/src/land/engine/ArcanistMercurialLandEngine.php @@ -108,7 +108,7 @@ final class ArcanistMercurialLandEngine $marker_type)); foreach ($named_markers as $named_marker) { - echo tsprintf('%s', $named_marker->newDisplayRef()); + echo tsprintf('%s', $named_marker->newRefView()); } echo tsprintf("\n"); @@ -327,7 +327,7 @@ final class ArcanistMercurialLandEngine pht('These branches were selected:')); foreach ($branches as $branch) { - echo tsprintf('%s', $branch->newDisplayRef()); + echo tsprintf('%s', $branch->newRefView()); } echo tsprintf("\n"); @@ -352,7 +352,7 @@ final class ArcanistMercurialLandEngine foreach ($new_markers as $new_marker) { - echo tsprintf('%s', $new_marker->newDisplayRef()); + echo tsprintf('%s', $new_marker->newRefView()); } echo tsprintf("\n"); diff --git a/src/ref/ArcanistDisplayRefInterface.php b/src/ref/ArcanistDisplayRefInterface.php deleted file mode 100644 index 550763ec..00000000 --- a/src/ref/ArcanistDisplayRefInterface.php +++ /dev/null @@ -1,8 +0,0 @@ -setRef($this); + + $this->buildRefView($ref_view); + + return $ref_view; } + + protected function buildRefView(ArcanistRefView $view) { + return null; + } + } diff --git a/src/ref/ArcanistDisplayRef.php b/src/ref/ArcanistRefView.php similarity index 58% rename from src/ref/ArcanistDisplayRef.php rename to src/ref/ArcanistRefView.php index 631b65b4..bb166aca 100644 --- a/src/ref/ArcanistDisplayRef.php +++ b/src/ref/ArcanistRefView.php @@ -1,13 +1,16 @@ ref = $ref; @@ -18,6 +21,24 @@ final class ArcanistDisplayRef return $this->ref; } + public function setObjectName($object_name) { + $this->objectName = $object_name; + return $this; + } + + public function getObjectName() { + return $this->objectName; + } + + public function setTitle($title) { + $this->title = $title; + return $this; + } + + public function getTitle() { + return $this->title; + } + public function setURI($uri) { $this->uri = $uri; return $this; @@ -27,21 +48,29 @@ final class ArcanistDisplayRef return $this->uri; } + public function addChild(ArcanistRefView $view) { + $this->children[] = $view; + return $this; + } + + private function getChildren() { + return $this->children; + } + public function appendLine($line) { $this->lines[] = $line; return $this; } public function newTerminalString() { + return $this->newLines(0); + } + + private function newLines($indent) { $ref = $this->getRef(); - if ($ref instanceof ArcanistDisplayRefInterface) { - $object_name = $ref->getDisplayRefObjectName(); - $title = $ref->getDisplayRefTitle(); - } else { - $object_name = null; - $title = $ref->getRefDisplayName(); - } + $object_name = $this->getObjectName(); + $title = $this->getTitle(); if ($object_name !== null) { $reserve_width = phutil_utf8_console_strlen($object_name) + 1; @@ -49,10 +78,18 @@ final class ArcanistDisplayRef $reserve_width = 0; } + if ($indent) { + $indent_text = str_repeat(' ', $indent); + } else { + $indent_text = ''; + } + $indent_width = strlen($indent_text); + $marker_width = 6; $display_width = phutil_console_get_terminal_width(); $usable_width = ($display_width - $marker_width - $reserve_width); + $usable_width = ($usable_width - $indent_width); // If the terminal is extremely narrow, don't degrade so much that the // output is completely unusable. @@ -75,22 +112,32 @@ final class ArcanistDisplayRef $display_text = $title; } - $ref = $this->getRef(); $output = array(); $output[] = tsprintf( - "** * ** %s\n", + "** * ** %s%s\n", + $indent_text, $display_text); $uri = $this->getURI(); if ($uri !== null) { $output[] = tsprintf( - "** :// ** __%s__\n", + "** :// ** %s__%s__\n", + $indent_text, $uri); } foreach ($this->lines as $line) { - $output[] = tsprintf(" %s\n", $line); + $output[] = tsprintf( + " %s%s\n", + $indent_text, + $line); + } + + foreach ($this->getChildren() as $child) { + foreach ($child->newLines($indent + 1) as $line) { + $output[] = $line; + } } return $output; diff --git a/src/ref/build/ArcanistBuildRef.php b/src/ref/build/ArcanistBuildRef.php index f2ffcd90..7b1fe227 100644 --- a/src/ref/build/ArcanistBuildRef.php +++ b/src/ref/build/ArcanistBuildRef.php @@ -1,9 +1,7 @@ getDisplayRefObjectName(); + return pht('Build %d', $this->getID()); } public static function newFromConduit(array $parameters) { @@ -37,12 +35,10 @@ final class ArcanistBuildRef return idxv($this->parameters, array('fields', 'name')); } - public function getDisplayRefObjectName() { - return pht('Build %d', $this->getID()); - } - - public function getDisplayRefTitle() { - return $this->getName(); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getRefDisplayName()) + ->setTitle($this->getName()); } public function getBuildPlanRef() { diff --git a/src/ref/buildable/ArcanistBuildableRef.php b/src/ref/buildable/ArcanistBuildableRef.php index bf19ebd1..b91df702 100644 --- a/src/ref/buildable/ArcanistBuildableRef.php +++ b/src/ref/buildable/ArcanistBuildableRef.php @@ -1,9 +1,7 @@ getID(); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { - return pht('Buildable %d', $this->getID()); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getMonogram()) + ->setTitle($this->getRefDisplayName()); } public function getBuildRefs() { diff --git a/src/ref/buildplan/ArcanistBuildPlanRef.php b/src/ref/buildplan/ArcanistBuildPlanRef.php index 37570513..ea0ad609 100644 --- a/src/ref/buildplan/ArcanistBuildPlanRef.php +++ b/src/ref/buildplan/ArcanistBuildPlanRef.php @@ -1,14 +1,12 @@ getDisplayRefObjectName(); + return pht('Build Plan %d', $this->getID()); } public static function newFromConduit(array $parameters) { @@ -29,14 +27,6 @@ final class ArcanistBuildPlanRef return idxv($this->parameters, array('fields', 'name')); } - public function getDisplayRefObjectName() { - return pht('Build Plan %d', $this->getID()); - } - - public function getDisplayRefTitle() { - return $this->getName(); - } - public function getBehavior($behavior_key, $default = null) { return idxv( $this->parameters, @@ -44,4 +34,10 @@ final class ArcanistBuildPlanRef $default); } + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getRefDisplayName()) + ->setTitle($this->getName()); + } + } diff --git a/src/ref/file/ArcanistFileRef.php b/src/ref/file/ArcanistFileRef.php index 37fcf520..615987e9 100644 --- a/src/ref/file/ArcanistFileRef.php +++ b/src/ref/file/ArcanistFileRef.php @@ -1,9 +1,7 @@ getID(); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { - return $this->getName(); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getMonogram()) + ->setTitle($this->getName()); } } diff --git a/src/ref/paste/ArcanistPasteRef.php b/src/ref/paste/ArcanistPasteRef.php index 2c4bb58d..bfeaa77b 100644 --- a/src/ref/paste/ArcanistPasteRef.php +++ b/src/ref/paste/ArcanistPasteRef.php @@ -1,9 +1,7 @@ getID(); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { - return $this->getTitle(); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getMonogram()) + ->setTitle($this->getName()); } } diff --git a/src/ref/revision/ArcanistRevisionRef.php b/src/ref/revision/ArcanistRevisionRef.php index c507baa4..8e73dec2 100644 --- a/src/ref/revision/ArcanistRevisionRef.php +++ b/src/ref/revision/ArcanistRevisionRef.php @@ -1,9 +1,7 @@ getHardpoint(self::HARDPOINT_BUILDABLEREF); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { - return $this->getName(); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getMonogram()) + ->setTitle($this->getTitle()); } } diff --git a/src/ref/task/ArcanistTaskRef.php b/src/ref/task/ArcanistTaskRef.php index d446b8df..ac918f77 100644 --- a/src/ref/task/ArcanistTaskRef.php +++ b/src/ref/task/ArcanistTaskRef.php @@ -1,9 +1,7 @@ getID(); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { - return $this->getName(); + protected function buildRefView(ArcanistRefView $view) { + $view + ->setObjectName($this->getMonogram()) + ->setTitle($this->getName()); } } diff --git a/src/ref/user/ArcanistUserRef.php b/src/ref/user/ArcanistUserRef.php index 0d27ca6b..d430682d 100644 --- a/src/ref/user/ArcanistUserRef.php +++ b/src/ref/user/ArcanistUserRef.php @@ -1,9 +1,7 @@ parameters, array('fields', 'realName')); } - public function getDisplayRefObjectName() { - return $this->getMonogram(); - } - - public function getDisplayRefTitle() { + protected function buildRefView(ArcanistRefView $view) { $real_name = $this->getRealName(); - if (strlen($real_name)) { $real_name = sprintf('(%s)', $real_name); } - return $real_name; + $view + ->setObjectName($this->getMonogram()) + ->setTitle($real_name); } + } diff --git a/src/repository/marker/ArcanistMarkerRef.php b/src/repository/marker/ArcanistMarkerRef.php index 77112b1e..a945d572 100644 --- a/src/repository/marker/ArcanistMarkerRef.php +++ b/src/repository/marker/ArcanistMarkerRef.php @@ -1,9 +1,7 @@ getDisplayRefObjectName(); - } - - public function getDisplayRefObjectName() { switch ($this->getMarkerType()) { case self::TYPE_BRANCH: return pht('Branch "%s"', $this->getName()); @@ -38,13 +32,6 @@ final class ArcanistMarkerRef } } - public function getDisplayRefTitle() { - return pht( - '%s %s', - $this->getDisplayHash(), - $this->getSummary()); - } - protected function newHardpoints() { return array( $this->newHardpoint(self::HARDPOINT_COMMITREF), @@ -98,8 +85,6 @@ final class ArcanistMarkerRef return $this->displayHash; } - - public function setCommitHash($commit_hash) { $this->commitHash = $commit_hash; return $this; @@ -177,4 +162,15 @@ final class ArcanistMarkerRef return $this->getHardpoint(self::HARDPOINT_REMOTEREF); } + protected function buildRefView(ArcanistRefView $view) { + $title = pht( + '%s %s', + $this->getDisplayHash(), + $this->getSummary()); + + $view + ->setObjectName($this->getRefDisplayName()) + ->setTitle($title); + } + } diff --git a/src/work/ArcanistWorkEngine.php b/src/work/ArcanistWorkEngine.php index 0d8a01ed..531270b8 100644 --- a/src/work/ArcanistWorkEngine.php +++ b/src/work/ArcanistWorkEngine.php @@ -163,7 +163,7 @@ abstract class ArcanistWorkEngine $revision_ref->getMonogram())); foreach ($selected as $marker) { - echo tsprintf('%s', $marker->newDisplayRef()); + echo tsprintf('%s', $marker->newRefView()); } echo tsprintf("\n"); @@ -177,7 +177,7 @@ abstract class ArcanistWorkEngine pht('REVISION'), pht('Resuming work on revision:')); - echo tsprintf('%s', $revision_ref->newDisplayRef()); + echo tsprintf('%s', $revision_ref->newRefView()); echo tsprintf("\n"); return $target; diff --git a/src/workflow/ArcanistAmendWorkflow.php b/src/workflow/ArcanistAmendWorkflow.php index be1cf25f..33288852 100644 --- a/src/workflow/ArcanistAmendWorkflow.php +++ b/src/workflow/ArcanistAmendWorkflow.php @@ -108,7 +108,7 @@ EOTEXT echo tsprintf( "%s\n\n%s\n", pht('Amending commit message to reflect revision:'), - $revision_ref->newDisplayRef()); + $revision_ref->newRefView()); $this->confirmAmendAuthor($revision_ref); $this->confirmAmendNotFound($revision_ref, $state_ref); @@ -193,7 +193,7 @@ EOTEXT "%!\n%W\n\n%B\n", pht('MULTIPLE REVISIONS IN WORKING COPY'), pht('More than one revision was found in the working copy:'), - mpull($revisions, 'newDisplayRef')); + mpull($revisions, 'newRefView')); throw new PhutilArgumentUsageException( pht( @@ -233,7 +233,7 @@ EOTEXT 'The author of this revision (%s) is:', $revision_ref->getMonogram()), ), - $author_ref->newDisplayRef()); + $author_ref->newRefView()); $prompt = pht( 'Amend working copy using revision owned by %s?', diff --git a/src/workflow/ArcanistPasteWorkflow.php b/src/workflow/ArcanistPasteWorkflow.php index 24468e7a..f9e2a693 100644 --- a/src/workflow/ArcanistPasteWorkflow.php +++ b/src/workflow/ArcanistPasteWorkflow.php @@ -159,7 +159,7 @@ EOTEXT echo tsprintf( '%s', - $paste_ref->newDisplayRef() + $paste_ref->newRefView() ->setURI($uri)); if ($is_browse) { diff --git a/src/workflow/ArcanistUploadWorkflow.php b/src/workflow/ArcanistUploadWorkflow.php index c9c9dd83..1ed34f46 100644 --- a/src/workflow/ArcanistUploadWorkflow.php +++ b/src/workflow/ArcanistUploadWorkflow.php @@ -119,7 +119,7 @@ EOTEXT $uri = $this->getAbsoluteURI($uri); echo tsprintf( '%s', - $ref->newDisplayRef() + $ref->newRefView() ->setURI($uri)); } }