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.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -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\'';
|
||||
|
Reference in New Issue
Block a user