1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 19:31: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(
PhabricatorRepository $repository,
$commit_identifier,
$branch) {
$branch,
$exists) {
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s',
@ -348,12 +349,14 @@ final class PhabricatorRepositoryPullLocalDaemon
$data->setCommitDetail('seenOnBranches', $branches);
$data->save();
self::insertTask(
$repository,
$commit,
array(
'only' => true
));
if (!$exists) {
self::insertTask(
$repository,
$commit,
array(
'only' => true
));
}
}
private static function insertTask(
@ -612,12 +615,19 @@ final class PhabricatorRepositoryPullLocalDaemon
$target);
$epoch = trim($epoch);
if ($branch !== null) {
self::updateCommit($repository, $target, $branch);
} else {
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %s AND commitIdentifier = %s',
$repository->getID(),
$target);
if (!$commit) {
self::recordCommit($repository, $target, $epoch);
}
if ($branch !== null) {
self::updateCommit($repository, $target, $branch, $commit);
}
if (empty($insert)) {
break;
}