From 22e606d49e83ba3cbffcabd9d2a2fd74ee6759da Mon Sep 17 00:00:00 2001 From: Jason Ge Date: Thu, 21 Jun 2012 19:46:22 -0700 Subject: [PATCH] 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 --- .../PhabricatorRepositoryPullLocalDaemon.php | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php index 7a0d53b025..ea1c0cd73a 100644 --- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php +++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php @@ -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; }