1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-24 15:52:40 +01:00

Provide more information about merge progress in "arc land" under Git

Summary: Ref T13546. Communicate more progress information and provide additional details when merge conflicts occur.

Test Plan: Hit a merge conflict, saw more helpful output.

Maniphest Tasks: T13546

Differential Revision: https://secure.phabricator.com/D21318
This commit is contained in:
epriestley 2020-06-05 13:15:43 -07:00
parent 1552397c86
commit 94f78cf87c

View file

@ -235,11 +235,13 @@ final class ArcanistGitLandEngine
protected function executeMerge(ArcanistLandCommitSet $set, $into_commit) { protected function executeMerge(ArcanistLandCommitSet $set, $into_commit) {
$api = $this->getRepositoryAPI(); $api = $this->getRepositoryAPI();
$log = $this->getLogEngine();
$this->updateWorkingCopy($into_commit); $this->updateWorkingCopy($into_commit);
$commits = $set->getCommits(); $commits = $set->getCommits();
$source_commit = last($commits)->getHash(); $max_commit = last($commits);
$source_commit = $max_commit->getHash();
// NOTE: See T11435 for some history. See PHI1727 for a case where a user // NOTE: See T11435 for some history. See PHI1727 for a case where a user
// modified their working copy while running "arc land". This attempts to // modified their working copy while running "arc land". This attempts to
@ -263,10 +265,15 @@ final class ArcanistGitLandEngine
$this->getDisplayHash($into_commit))); $this->getDisplayHash($into_commit)));
} }
list($original_author, $original_date) = $this->getAuthorAndDate( $log->writeStatus(
$source_commit); pht('MERGING'),
pht(
'%s %s',
$this->getDisplayHash($source_commit),
$max_commit->getDisplaySummary()));
try { try {
if ($this->isSquashStrategy()) { if ($this->isSquashStrategy()) {
// NOTE: We're explicitly specifying "--ff" to override the presence // NOTE: We're explicitly specifying "--ff" to override the presence
// of "merge.ff" options in user configuration. // of "merge.ff" options in user configuration.
@ -280,17 +287,44 @@ final class ArcanistGitLandEngine
$source_commit); $source_commit);
} }
} catch (CommandException $ex) { } catch (CommandException $ex) {
// TODO: If we previously succeeded with at least one merge, we could
// provide a hint that "--incremental" can do some of the work.
$api->execManualLocal('merge --abort'); $api->execManualLocal('merge --abort');
$api->execManualLocal('reset --hard HEAD --'); $api->execManualLocal('reset --hard HEAD --');
throw new PhutilArgumentUsageException( $direct_symbols = $max_commit->getDirectSymbols();
pht( $indirect_symbols = $max_commit->getIndirectSymbols();
'Local "%s" does not merge cleanly into "%s". Merge or rebase '. if ($direct_symbols) {
'local changes so they can merge cleanly.', $message = pht(
$source_commit, 'Local commit "%s" (%s) does not merge cleanly into "%s". '.
$into_commit)); 'Merge or rebase local changes so they can merge cleanly.',
$this->getDisplayHash($source_commit),
$this->getDisplaySymbols($direct_symbols),
$this->getDisplayHash($into_commit));
} else if ($indirect_symbols) {
$message = pht(
'Local commit "%s" (reachable from: %s) does not merge cleanly '.
'into "%s". Merge or rebase local changes so they can merge '.
'cleanly.',
$this->getDisplayHash($source_commit),
$this->getDisplaySymbols($indirect_symbols),
$this->getDisplayHash($into_commit));
} else {
$message = pht(
'Local commit "%s" does not merge cleanly into "%s". Merge or '.
'rebase local changes so they can merge cleanly.',
$this->getDisplayHash($source_commit),
$this->getDisplayHash($into_commit));
} }
throw new PhutilArgumentUsageException($message);
}
list($original_author, $original_date) = $this->getAuthorAndDate(
$source_commit);
$revision_ref = $set->getRevisionRef(); $revision_ref = $set->getRevisionRef();
$commit_message = $revision_ref->getCommitMessage(); $commit_message = $revision_ref->getCommitMessage();