Fixed issue 61, better sync of the source changelog with the latest updates.

The sync is made automatically on all the branches of the project when
looking at the timeline after a given time.
dev
Loic d'Anterroches 2008-11-27 09:30:12 +01:00
parent 08f6c5fc79
commit 93c44feb05
2 changed files with 21 additions and 0 deletions

View File

@ -81,5 +81,25 @@ class IDF_Scm
}
return $res;
}
/**
* Sync the changes in the repository with the timeline.
*
*/
public static function syncTimeline($request)
{
$cache = Pluf_Cache::factory();
$key = 'IDF_Scm:'.$request->project->shortname.':lastsync';
if (null === ($res=$cache->get($key))) {
$scm = IDF_Scm::get($request);
foreach ($scm->getBranches() as $branche) {
foreach ($scm->getChangeLog($branche, 25) as $change) {
IDF_Commit::getOrAdd($change, $request->project);
}
}
$cache->set($key, true, (int)(Pluf::f('cache_timeout', 300)/2));
}
}
}

View File

@ -79,6 +79,7 @@ class IDF_Views_Project
$rights = array();
if (true === IDF_Precondition::accessSource($request)) {
$rights[] = '\'IDF_Commit\'';
IDF_Scm::syncTimeline($request);
}
if (true === IDF_Precondition::accessIssues($request)) {
$rights[] = '\'IDF_Issue\'';