1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-05 12:21:02 +01:00

run record commit if its the first time seen

Test Plan: test live.

Reviewers: nh

Reviewed By: nh

CC: epriestley, aran

Differential Revision: https://secure.phabricator.com/D2832
This commit is contained in:
Jason Ge 2012-06-21 19:46:22 -07:00
parent 06c976b738
commit 22e606d49e

View file

@ -329,7 +329,8 @@ final class PhabricatorRepositoryPullLocalDaemon
private static function updateCommit( private static function updateCommit(
PhabricatorRepository $repository, PhabricatorRepository $repository,
$commit_identifier, $commit_identifier,
$branch) { $branch,
$exists) {
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere( $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s', 'repositoryID = %s AND commitIdentifier = %s',
@ -348,12 +349,14 @@ final class PhabricatorRepositoryPullLocalDaemon
$data->setCommitDetail('seenOnBranches', $branches); $data->setCommitDetail('seenOnBranches', $branches);
$data->save(); $data->save();
self::insertTask( if (!$exists) {
$repository, self::insertTask(
$commit, $repository,
array( $commit,
'only' => true array(
)); 'only' => true
));
}
} }
private static function insertTask( private static function insertTask(
@ -612,12 +615,19 @@ final class PhabricatorRepositoryPullLocalDaemon
$target); $target);
$epoch = trim($epoch); $epoch = trim($epoch);
if ($branch !== null) { $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
self::updateCommit($repository, $target, $branch); 'repositoryID = %s AND commitIdentifier = %s',
} else { $repository->getID(),
$target);
if (!$commit) {
self::recordCommit($repository, $target, $epoch); self::recordCommit($repository, $target, $epoch);
} }
if ($branch !== null) {
self::updateCommit($repository, $target, $branch, $commit);
}
if (empty($insert)) { if (empty($insert)) {
break; break;
} }