Changeset View
Changeset View
Standalone View
Standalone View
src/land/engine/ArcanistGitLandEngine.php
| Show First 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | private function fetchTarget(ArcanistLandTarget $target) { | ||||
| if ($this->getIsGitPerforce()) { | if ($this->getIsGitPerforce()) { | ||||
| $log->writeStatus( | $log->writeStatus( | ||||
| pht('P4 SYNC'), | pht('P4 SYNC'), | ||||
| pht( | pht( | ||||
| 'Synchronizing "%s" from Perforce...', | 'Synchronizing "%s" from Perforce...', | ||||
| $target->getRef())); | $target->getRef())); | ||||
| $err = $api->execPassthru( | $err = $this->newPassthru( | ||||
| 'p4 sync --silent --branch %s --', | 'p4 sync --silent --branch %s --', | ||||
| $target->getRemote().'/'.$target->getRef()); | $target->getRemote().'/'.$target->getRef()); | ||||
| if ($err) { | if ($err) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| 'Perforce sync failed! Fix the error and run "arc land" again.')); | 'Perforce sync failed! Fix the error and run "arc land" again.')); | ||||
| } | } | ||||
| return $this->getLandTargetLocalCommit($target); | return $this->getLandTargetLocalCommit($target); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | if ($this->getIsGitPerforce()) { | ||||
| // Detect moves and submit them to Perforce as move operations. | // Detect moves and submit them to Perforce as move operations. | ||||
| $flags_argv[] = '-M'; | $flags_argv[] = '-M'; | ||||
| // If we run into a conflict, abort the operation. We expect users to | // If we run into a conflict, abort the operation. We expect users to | ||||
| // fix conflicts and run "arc land" again. | // fix conflicts and run "arc land" again. | ||||
| $flags_argv[] = '--conflict=quit'; | $flags_argv[] = '--conflict=quit'; | ||||
| $err = $api->execPassthru( | $err = $this->newPassthru( | ||||
| '%LR p4 submit %LR --commit %R --', | '%LR p4 submit %LR --commit %R --', | ||||
| $config_argv, | $config_argv, | ||||
| $flags_argv, | $flags_argv, | ||||
| $into_commit); | $into_commit); | ||||
| if ($err) { | if ($err) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| 'Submit failed! Fix the error and run "arc land" again.')); | 'Submit failed! Fix the error and run "arc land" again.')); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| $log->writeStatus( | $log->writeStatus( | ||||
| pht('PUSHING'), | pht('PUSHING'), | ||||
| pht('Pushing changes to "%s".', $this->getOntoRemote())); | pht('Pushing changes to "%s".', $this->getOntoRemote())); | ||||
| $err = $api->execPassthru( | $err = $this->newPassthru( | ||||
| 'push -- %s %Ls', | 'push -- %s %Ls', | ||||
| $this->getOntoRemote(), | $this->getOntoRemote(), | ||||
| $this->newOntoRefArguments($into_commit)); | $this->newOntoRefArguments($into_commit)); | ||||
| if ($err) { | if ($err) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| 'Push failed! Fix the error and run "arc land" again.')); | 'Push failed! Fix the error and run "arc land" again.')); | ||||
| ▲ Show 20 Lines • Show All 846 Lines • ▼ Show 20 Lines | private function resolveLandTargetLocalCommit(ArcanistLandTarget $target) { | ||||
| return $this->landTargetCommitMap[$target_key]; | return $this->landTargetCommitMap[$target_key]; | ||||
| } | } | ||||
| private function fetchLandTarget( | private function fetchLandTarget( | ||||
| ArcanistLandTarget $target, | ArcanistLandTarget $target, | ||||
| $ignore_failure = false) { | $ignore_failure = false) { | ||||
| $api = $this->getRepositoryAPI(); | $api = $this->getRepositoryAPI(); | ||||
| // TODO: Format this fetch nicely as a workflow command. | $err = $this->newPassthru( | ||||
| $err = $api->execPassthru( | |||||
| 'fetch --no-tags --quiet -- %s %s', | 'fetch --no-tags --quiet -- %s %s', | ||||
| $target->getRemote(), | $target->getRemote(), | ||||
| $target->getRef()); | $target->getRef()); | ||||
| if ($err && !$ignore_failure) { | if ($err && !$ignore_failure) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht( | pht( | ||||
| 'Fetch of "%s" from remote "%s" failed! Fix the error and '. | 'Fetch of "%s" from remote "%s" failed! Fix the error and '. | ||||
| 'run "arc land" again.', | 'run "arc land" again.', | ||||
| ▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines | |||||