diff --git a/Source/pages/checkin.php b/Source/pages/checkin.php index 5f97113..5a6e119 100644 --- a/Source/pages/checkin.php +++ b/Source/pages/checkin.php @@ -84,21 +84,10 @@ } # Let the plugins handle commit data -$t_changesets = event_signal( 'EVENT_SOURCE_COMMIT', array( $t_repo, $f_data ) ); +$t_status = event_signal( 'EVENT_SOURCE_COMMIT', array( $t_repo, $f_data ) ); # Changesets couldn't be loaded apparently -if ( is_null( $t_changesets ) ) { +if ( !$t_status ) { die( plugin_lang_get( 'invalid_changeset' ) ); } -# Save all changesets found by the check-in -if ( is_array( $t_changesets ) ) { - foreach ( $t_changesets as $t_changeset ) { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); - } -} else { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); -} - diff --git a/SourceGithub/SourceGithub.php b/SourceGithub/SourceGithub.php index fb5b31f..523c7b7 100644 --- a/SourceGithub/SourceGithub.php +++ b/SourceGithub/SourceGithub.php @@ -218,9 +218,9 @@ $t_commits[] = $t_id; } - $t_result = $this->import_json_commits( $p_repo, $this->uri_base( $p_repo ), $t_commits ); + $t_result = $this->import_commits( $p_repo, $this->uri_base( $p_repo ), $t_commits ); - return array(); + return true; } function import_repo( $p_event, $p_repo ) { @@ -234,18 +234,18 @@ $t_branch = 'master'; } - $t_result = $this->import_json_commits( $p_repo, $this->uri_base( $p_repo ), $t_branch ); + $t_result = $this->import_commits( $p_repo, $this->uri_base( $p_repo ), $t_branch ); echo ''; return true; } - function import_json_commits( $p_repo, $p_uri_base, $p_commit_id ) { - if ( is_array( $p_commit_id ) ) { + function import_commits( $p_repo, $p_uri_base, $p_commit_ids ) { + if ( is_array( $p_commit_ids ) ) { $t_parents = $p_commit_id; } else { - $t_parents = array( $p_commit_id ); + $t_parents = array( $p_commit_ids ); } while( count( $t_parents ) > 0 ) { diff --git a/SourceSFSVN/SourceSFSVN.php b/SourceSFSVN/SourceSFSVN.php index 14a3ae4..2cd465d 100644 --- a/SourceSFSVN/SourceSFSVN.php +++ b/SourceSFSVN/SourceSFSVN.php @@ -166,9 +166,7 @@ $t_url = $p_repo->url; $t_svnlog = explode( "\n", `svn log -v $t_url` ); - $this->process_svn_log( $p_repo, $t_svnlog, false ); - - return true; + return $this->process_svn_log( $p_repo, $t_svnlog ); } function check_svn() { @@ -181,7 +179,6 @@ $t_state = 0; $t_svnline = str_pad( '', 72, '-' ); - $t_changesets = array(); $t_changeset = null; $t_comments = ''; $t_count = 0; @@ -197,12 +194,8 @@ # Changeset info } elseif ( 1 == $t_state && preg_match( '/^r([0-9]+) \| (\w+) \| ([0-9\-]+) ([0-9:]+)/', $t_line, $t_matches ) ) { if ( !is_null( $t_changeset ) ) { - if ( $p_return_sets ) { - $t_changesets[] = $t_changeset; - } else { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); - } + $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); + $t_changeset->save(); } $t_user_id = user_get_id_by_name( $t_matches[2] ); @@ -260,14 +253,10 @@ } if ( !is_null( $t_changeset ) ) { - if ( $p_return_sets ) { - $t_changesets[] = $t_changeset; - } else { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); - } + $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); + $t_changeset->save(); } - return $t_changesets; + return true; } } diff --git a/SourceWebSVN/SourceWebSVN.php b/SourceWebSVN/SourceWebSVN.php index b9d4d42..b6caa98 100644 --- a/SourceWebSVN/SourceWebSVN.php +++ b/SourceWebSVN/SourceWebSVN.php @@ -177,9 +177,7 @@ $t_url = $p_repo->url; $t_svnlog = explode( "\n", `svn log -v $t_url` ); - $this->process_svn_log( $p_repo, $t_svnlog, false ); - - return true; + return $this->process_svn_log( $p_repo, $t_svnlog ); } function check_svn() { @@ -188,11 +186,10 @@ } } - function process_svn_log( $p_repo, $p_svnlog, $p_return_sets=true ) { + function process_svn_log( $p_repo, $p_svnlog ) { $t_state = 0; $t_svnline = str_pad( '', 72, '-' ); - $t_changesets = array(); $t_changeset = null; $t_comments = ''; $t_count = 0; @@ -208,12 +205,8 @@ # Changeset info } elseif ( 1 == $t_state && preg_match( '/^r([0-9]+) \| (\w+) \| ([0-9\-]+) ([0-9:]+)/', $t_line, $t_matches ) ) { if ( !is_null( $t_changeset ) ) { - if ( $p_return_sets ) { - $t_changesets[] = $t_changeset; - } else { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); - } + $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); + $t_changeset->save(); } $t_user_id = user_get_id_by_name( $t_matches[2] ); @@ -271,14 +264,10 @@ } if ( !is_null( $t_changeset ) ) { - if ( $p_return_sets ) { - $t_changesets[] = $t_changeset; - } else { - $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); - $t_changeset->save(); - } + $t_changeset->bugs = Source_Parse_Buglinks( $t_changeset->message ); + $t_changeset->save(); } - return $t_changesets; + return true; } }