private function applyMerge(DrydockLease $lease, DrydockCommandInterface $interface, array $merge) { $src_uri = $merge['src.uri']; $src_ref = $merge['src.ref']; $interface->execx('git fetch --no-tags -- %s +%s:%s', $src_uri, $src_ref, $src_ref); // NOTE: This can never actually generate a commit because we pass // "--squash", but git sometimes runs code to check that a username and // email are configured anyway. $real_command = csprintf('git -c user.name=%s -c user.email=%s merge --no-stat --squash -- %R', 'drydock', 'drydock@phabricator', $src_ref); // Show the user a simplified command if the operation fails and we need to // report an error. $show_command = csprintf('git merge --squash -- %R', $src_ref); try { $interface->execx('%C', $real_command); } catch (CommandException $ex) { $error = DrydockCommandError::newFromCommandException(self::PHASE_SQUASHMERGE, $show_command, $ex); $lease->setAttribute('workingcopy.vcs.error', $error); throw $ex; } }
private function applyMerge(DrydockLease $lease, DrydockCommandInterface $interface, array $merge) { $src_uri = $merge['src.uri']; $src_ref = $merge['src.ref']; try { $interface->execx('git fetch --no-tags -- %s +%s:%s', $src_uri, $src_ref, $src_ref); } catch (CommandException $ex) { $display_command = csprintf('git fetch %R +%R:%R', $src_uri, $src_ref, $src_ref); $error = DrydockCommandError::newFromCommandException($ex)->setPhase(self::PHASE_MERGEFETCH)->setDisplayCommand($display_command); $lease->setAttribute('workingcopy.vcs.error', $error->toDictionary()); throw $ex; } // NOTE: This can never actually generate a commit because we pass // "--squash", but git sometimes runs code to check that a username and // email are configured anyway. $real_command = csprintf('git -c user.name=%s -c user.email=%s merge --no-stat --squash -- %R', 'drydock', 'drydock@phabricator', $src_ref); try { $interface->execx('%C', $real_command); } catch (CommandException $ex) { $display_command = csprintf('git merge --squash %R', $src_ref); $error = DrydockCommandError::newFromCommandException($ex)->setPhase(self::PHASE_SQUASHMERGE)->setDisplayCommand($display_command); $lease->setAttribute('workingcopy.vcs.error', $error->toDictionary()); throw $ex; } }