本文整理匯總了PHP中DifferentialRevision::loadActiveDiff方法的典型用法代碼示例。如果您正苦於以下問題:PHP DifferentialRevision::loadActiveDiff方法的具體用法?PHP DifferentialRevision::loadActiveDiff怎麽用?PHP DifferentialRevision::loadActiveDiff使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DifferentialRevision
的用法示例。
在下文中一共展示了DifferentialRevision::loadActiveDiff方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: commitRevisionToWorkspace
public function commitRevisionToWorkspace(DifferentialRevision $revision, ArcanistRepositoryAPI $workspace, PhabricatorUser $user)
{
$diff_id = $revision->loadActiveDiff()->getID();
$call = new ConduitCall('differential.getrawdiff', array('diffID' => $diff_id));
$call->setUser($user);
$raw_diff = $call->execute();
$future = $workspace->execFutureLocal('patch --no-commit -');
$future->write($raw_diff);
$future->resolvex();
$workspace->reloadWorkingCopy();
$call = new ConduitCall('differential.getcommitmessage', array('revision_id' => $revision->getID()));
$call->setUser($user);
$message = $call->execute();
$author = id(new PhabricatorUser())->loadOneWhere('phid = %s', $revision->getAuthorPHID());
$author_string = sprintf('%s <%s>', $author->getRealName(), $author->loadPrimaryEmailAddress());
$author_date = $revision->getDateCreated();
$workspace->execxLocal('commit --date=%s --user=%s ' . '--message=%s', $author_date . ' 0', $author_string, $message);
}
示例2: commitRevisionToWorkspace
public function commitRevisionToWorkspace(DifferentialRevision $revision, ArcanistRepositoryAPI $workspace, PhabricatorUser $user)
{
$diff_id = $revision->loadActiveDiff()->getID();
$call = new ConduitCall('differential.getrawdiff', array('diffID' => $diff_id));
$call->setUser($user);
$raw_diff = $call->execute();
$missing_binary = "\nindex " . "0000000000000000000000000000000000000000.." . "0000000000000000000000000000000000000000\n";
if (strpos($raw_diff, $missing_binary) !== false) {
throw new Exception(pht('Patch is missing content for a binary file'));
}
$future = $workspace->execFutureLocal('apply --index -');
$future->write($raw_diff);
$future->resolvex();
$workspace->reloadWorkingCopy();
$call = new ConduitCall('differential.getcommitmessage', array('revision_id' => $revision->getID()));
$call->setUser($user);
$message = $call->execute();
$author = id(new PhabricatorUser())->loadOneWhere('phid = %s', $revision->getAuthorPHID());
$author_string = sprintf('%s <%s>', $author->getRealName(), $author->loadPrimaryEmailAddress());
$author_date = $revision->getDateCreated();
$workspace->execxLocal('-c user.name=%s -c user.email=%s ' . 'commit --date=%s --author=%s ' . '--message=%s', $user->getRealName(), $user->loadPrimaryEmailAddress(), $author_date, $author_string, $message);
}