Skip to content

Commit daf4bac

Browse files
committed
Improve Phabricator links during cross-project merging
1 parent 4e8764f commit daf4bac

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1010

1111
### Changed
1212
- The recursive working copy lookup behavior of the `aggregate` command is disabled by default, but can be enabled via new `--recursive` option.
13+
- Improve Phabricator integration during `merge` command by using `.arcconfig` file from the merge source repository.
1314

1415
### Fixed
1516
- Attempt to print commit history of paths copied to themselves (e.g. trunk > branches/something > trunk) resulted in a recursion.

src/SVNBuddy/Command/MergeCommand.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ConsoleHelpers\SVNBuddy\Config\ChoiceConfigSetting;
1717
use ConsoleHelpers\SVNBuddy\Config\StringConfigSetting;
1818
use ConsoleHelpers\ConsoleKit\Exception\CommandException;
19+
use ConsoleHelpers\SVNBuddy\Exception\RepositoryCommandException;
1920
use ConsoleHelpers\SVNBuddy\Helper\OutputHelper;
2021
use ConsoleHelpers\SVNBuddy\MergeSourceDetector\AbstractMergeSourceDetector;
2122
use ConsoleHelpers\SVNBuddy\Repository\Connector\UrlResolver;
@@ -611,7 +612,7 @@ protected function performMerge($source_url, $wc_path, array $revisions)
611612
$param_string_ending = '--record-only ' . $param_string_ending;
612613
}
613614

614-
$revision_title_mask = $this->getRevisionTitle($wc_path);
615+
$revision_title_mask = $this->getRevisionTitle($source_url);
615616

616617
foreach ( $revisions as $index => $revision ) {
617618
$command = $this->repositoryConnector->getCommand(
@@ -639,26 +640,31 @@ protected function performMerge($source_url, $wc_path, array $revisions)
639640
/**
640641
* Returns revision title.
641642
*
642-
* @param string $wc_path Working copy path.
643+
* @param string $source_url Merge source: url.
643644
*
644645
* @return string
645646
*/
646-
protected function getRevisionTitle($wc_path)
647+
protected function getRevisionTitle($source_url)
647648
{
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.
651657
return '<fg=white;options=underscore>{revision}</> revision';
652658
}
653659

654-
$arcanist_config = \json_decode(\file_get_contents($arcanist_config_file), true);
655-
660+
// Phabricator integration is not configured correctly.
656661
if ( !\is_array($arcanist_config)
657662
|| !isset($arcanist_config['repository.callsign'], $arcanist_config['phabricator.uri'])
658663
) {
659664
return '<fg=white;options=underscore>{revision}</> revision';
660665
}
661666

667+
// Phabricator integration is configured properly.
662668
$revision_title = $arcanist_config['phabricator.uri'];
663669
$revision_title .= 'r' . $arcanist_config['repository.callsign'] . '{revision}';
664670

0 commit comments

Comments
 (0)