fetching logs does not work

leop - January 18, 2008 - 15:45
Project:Subversion
Version:5.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

There is something I don't quite understand about the subversion_repository_fetch function. When called by admin/project/subversion-repositories/fetch/ rid, it takes as input argument the id of the repository rid. Then it checks whether a project exists for that repository:

if ($repo = db_fetch_object(db_query("SELECT * FROM {subversion_projects} WHERE rid = %d", $rid))) {

I suppose this should be a check whether the repository exisits:

if ($repo = db_fetch_object(db_query("SELECT * FROM {subversion_repositories} WHERE rid = %d", $rid))) {

Next, for some reason unbeknown to me, a non-existing node is loaded with $project = node_load($ret->nid). The variable $ret is not defined here, so this results in an error. The author of the code probably meant to load a node object, so he should have written $project = node_load($repo->nid);, but since in my opinion $repo should be loaded from the subversion_repositories table instead of the subversion_projects table, the line $project = node_load($ret->nid); should be removed. The next line

subversion_fetch_repository($project)

then becomes:

subversion_fetch_repository($repo)

In short, I propose to change the function subversion_repository_fetch into:

<?php

function subversion_repository_fetch($rid) {
 
// Set timeout limit to 3600 seconds as it can take a long time to process the log initially.
 
if (!ini_get("safe_mode")) {
   
set_time_limit(3600);
  }

  if (
$repo = db_fetch_object(db_query("SELECT * FROM {subversion_repositories} WHERE rid = %d", $rid))) {
   
subversion_fetch_repository($repo);
   
drupal_set_message(t('fetched new log entries.'));
  }
 
subversion_repository();
}
?>

Or am I missing something?

#1

leop - January 18, 2008 - 15:48
Status:active» needs review

Actually I propose a fix, so status changed to patch (code needs review)

#2

halkeye - January 21, 2008 - 05:13
Status:needs review» fixed

what you gave isn't considered a patch..
http://drupal.org/patch

I've patched the code using your suggestion.
This is again something i don't personally use, so it broke over time.

#3

Anonymous (not verified) - February 4, 2008 - 05:24
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.