diff --git a/commitlog/commitlog.module b/commitlog/commitlog.module index 6c4657e..5e4c5db 100644 --- a/commitlog/commitlog.module +++ b/commitlog/commitlog.module @@ -947,7 +947,7 @@ function theme_commitlog_operation_items($operation, $operation_items, $format = // make a displayable string out of those. if (!empty($item['source_items'])) { $oldrev_string = theme('commitlog_item_revision', - $operation->repository, reset($item['source_items']), $format + $operation->repository, reset($item->source_items), $format ); $olditems = array(); @@ -1136,7 +1136,7 @@ function theme_commitlog_diff_link($operation, $item) { // Also, a diff only makes sense if the item was actually modified. if (in_array($item['action'], array(VERSIONCONTROL_ACTION_MODIFIED, VERSIONCONTROL_ACTION_MERGED))) { // Ok, everything's alright, let's get that diff link. - $source_item = reset($item['source_items']); + $source_item = reset($item->source_items); $diff_url = versioncontrol_get_url_diff( $operation->repository, $item, $source_item ); diff --git a/includes/VersioncontrolOperation.php b/includes/VersioncontrolOperation.php index 49b2b27..01f1f30 100644 --- a/includes/VersioncontrolOperation.php +++ b/includes/VersioncontrolOperation.php @@ -601,9 +601,9 @@ public function insert(&$operation_items) { // If we've got source items (which is the case for commit operations), // add them to the item revisions and source revisions tables as well. - foreach ($item['source_items'] as $key => $source_item) { + foreach ($item->source_items as $key => $source_item) { $source_item->ensure(); - $item->insertSourceRevision($source_item, $item['action']); + $item->insertSourceRevision($source_item, $item->action); // Cache other important items in the operations table for 'path' search // queries, because joining the source revisions table is too expensive. @@ -611,7 +611,7 @@ public function insert(&$operation_items) { case VERSIONCONTROL_ACTION_MOVED: case VERSIONCONTROL_ACTION_COPIED: case VERSIONCONTROL_ACTION_MERGED: - if ($item['path'] != $source_item['path']) { + if ($item->path != $source_item->path) { $this->_insert_operation_item($source_item, VERSIONCONTROL_OPERATION_CACHED_AFFECTED_ITEM); } @@ -620,12 +620,12 @@ public function insert(&$operation_items) { break; } - $source_item['selected_label'] = new stdClass(); - $source_item['selected_label']->get_from = 'other_item'; - $source_item['selected_label']->other_item = &$item; - $source_item['selected_label']->other_item_tags = array('successor_item'); + $source_item->selected_label = new stdClass(); + $source_item->selected_label->get_from = 'other_item'; + $source_item->selected_label->other_item = &$item; + $source_item->selected_label->other_item_tags = array('successor_item'); - $item['source_items'][$key] = $source_item; + $item->source_items[$key] = $source_item; } // Plus a special case for the "added" action, as it needs an entry in the // source items table but contains no items in the 'source_items' property. @@ -635,14 +635,14 @@ public function insert(&$operation_items) { // If we've got a replaced item (might happen for copy/move commits), // add it to the item revisions and source revisions table as well. - if (isset($item['replaced_item'])) { - $item['replaced_item']->ensure(); - $item->insertSourceRevision($item['replaced_item'], + if (isset($item->replaced_item)) { + $item->replaced_item->ensure(); + $item->insertSourceRevision($item->replaced_item, VERSIONCONTROL_ACTION_REPLACED); - $item['replaced_item']['selected_label'] = new stdClass(); - $item['replaced_item']['selected_label']->get_from = 'other_item'; - $item['replaced_item']['selected_label']->other_item = &$item; - $item['replaced_item']['selected_label']->other_item_tags = array('successor_item'); + $item->replaced_item->selected_label = new stdClass(); + $item->replaced_item->selected_label->get_from = 'other_item'; + $item->replaced_item->selected_label->other_item = &$item; + $item->replaced_item->selected_label->other_item_tags = array('successor_item'); } $operation_items[$path] = $item; } diff --git a/versioncontrol.module b/versioncontrol.module index 18b836a..414094b 100644 --- a/versioncontrol.module +++ b/versioncontrol.module @@ -1090,24 +1090,25 @@ function versioncontrol_fetch_source_items($repository, &$items) { while ($item_revision = db_fetch_object($result)) { $successor_key = $item_keys[$item_revision->item_revision_id]; - if (!isset($items[$successor_key]['source_items'])) { - $items[$successor_key]['source_items'] = array(); + if (!isset($items[$successor_key]->source_items)) { + $items[$successor_key]->source_items = array(); } - $item = array( - 'path' => $item_revision->path, - 'revision' => $item_revision->revision, - 'type' => $item_revision->type, - 'item_revision_id' => $item_revision->source_item_revision_id, + $item = new VersioncontrolItem( + $item_revision->type, + $item_revision->path, + $item_revision->revision, + null, + null ); - $item['selected_label'] = new stdClass(); - $item['selected_label']->get_from = 'other_item'; - $item['selected_label']->other_item = &$items[$successor_key]; - $item['selected_label']->other_item_tags = array('successor_item'); + $item->selected_label = new stdClass(); + $item->selected_label->get_from = 'other_item'; + $item->selected_label->other_item = &$items[$successor_key]; + $item->selected_label->other_item_tags = array('successor_item'); // Insert the item and its associated action into the successor item. if ($item_revision->action == VERSIONCONTROL_ACTION_REPLACED) { - $items[$successor_key]['replaced_item'] = $item; + $items[$successor_key]->replaced_item = $item; } else if ($item_revision->action == VERSIONCONTROL_ACTION_ADDED) { $items[$successor_key]['action'] = $item_revision->action; @@ -1115,15 +1116,15 @@ function versioncontrol_fetch_source_items($repository, &$items) { // instead of adding it to the source items. } else { - $items[$successor_key]['action'] = $item_revision->action; - $items[$successor_key]['source_items'][$item['path']] = $item; + $items[$successor_key]->action = $item_revision->action; + $items[$successor_key]->source_items[$item->path] = $item; } // Add the lines-changed information if it has been recorded. // Only a single source item entry should hold this information, // so no emphasis is placed on merging it across multiple source items. if ($item_revision->line_changes_recorded) { - $items[$successor_key]['line_changes'] = array( + $items[$successor_key]->line_changes = array( 'added' => $item_revision->line_changes_added, 'removed' => $item_revision->line_changes_removed, );