|
16 | 16 | use ConsoleHelpers\SVNBuddy\Config\ChoiceConfigSetting; |
17 | 17 | use ConsoleHelpers\SVNBuddy\Config\StringConfigSetting; |
18 | 18 | use ConsoleHelpers\ConsoleKit\Exception\CommandException; |
| 19 | +use ConsoleHelpers\SVNBuddy\Exception\RepositoryCommandException; |
19 | 20 | use ConsoleHelpers\SVNBuddy\Helper\OutputHelper; |
20 | 21 | use ConsoleHelpers\SVNBuddy\MergeSourceDetector\AbstractMergeSourceDetector; |
21 | 22 | use ConsoleHelpers\SVNBuddy\Repository\Connector\UrlResolver; |
@@ -611,7 +612,7 @@ protected function performMerge($source_url, $wc_path, array $revisions) |
611 | 612 | $param_string_ending = '--record-only ' . $param_string_ending; |
612 | 613 | } |
613 | 614 |
|
614 | | - $revision_title_mask = $this->getRevisionTitle($wc_path); |
| 615 | + $revision_title_mask = $this->getRevisionTitle($source_url); |
615 | 616 |
|
616 | 617 | foreach ( $revisions as $index => $revision ) { |
617 | 618 | $command = $this->repositoryConnector->getCommand( |
@@ -639,26 +640,31 @@ protected function performMerge($source_url, $wc_path, array $revisions) |
639 | 640 | /** |
640 | 641 | * Returns revision title. |
641 | 642 | * |
642 | | - * @param string $wc_path Working copy path. |
| 643 | + * @param string $source_url Merge source: url. |
643 | 644 | * |
644 | 645 | * @return string |
645 | 646 | */ |
646 | | - protected function getRevisionTitle($wc_path) |
| 647 | + protected function getRevisionTitle($source_url) |
647 | 648 | { |
648 | | - $arcanist_config_file = $wc_path . \DIRECTORY_SEPARATOR . '.arcconfig'; |
649 | | - |
650 | | - if ( !\file_exists($arcanist_config_file) ) { |
| 649 | + try { |
| 650 | + $arcanist_config = \json_decode( |
| 651 | + $this->repositoryConnector->getFileContent($source_url . '/.arcconfig', 'HEAD'), |
| 652 | + true |
| 653 | + ); |
| 654 | + } |
| 655 | + catch ( RepositoryCommandException $e ) { |
| 656 | + // Phabricator integration is not configured. |
651 | 657 | return '<fg=white;options=underscore>{revision}</> revision'; |
652 | 658 | } |
653 | 659 |
|
654 | | - $arcanist_config = \json_decode(\file_get_contents($arcanist_config_file), true); |
655 | | - |
| 660 | + // Phabricator integration is not configured correctly. |
656 | 661 | if ( !\is_array($arcanist_config) |
657 | 662 | || !isset($arcanist_config['repository.callsign'], $arcanist_config['phabricator.uri']) |
658 | 663 | ) { |
659 | 664 | return '<fg=white;options=underscore>{revision}</> revision'; |
660 | 665 | } |
661 | 666 |
|
| 667 | + // Phabricator integration is configured properly. |
662 | 668 | $revision_title = $arcanist_config['phabricator.uri']; |
663 | 669 | $revision_title .= 'r' . $arcanist_config['repository.callsign'] . '{revision}'; |
664 | 670 |
|
|
0 commit comments