diff --git a/SourceGitweb/SourceGitweb.php b/SourceGitweb/SourceGitweb.php index 4c531aa..a318724 100644 --- a/SourceGitweb/SourceGitweb.php +++ b/SourceGitweb/SourceGitweb.php @@ -52,7 +52,7 @@ $t_ref = substr( $p_changeset->revision, 0, 8 ); $t_branch = $p_changeset->branch; - return "$t_branch $t_ref"; + return "$t_branch revision\">$t_ref"; } function show_file( $p_event, $p_repo, $p_changeset, $p_file ) { @@ -90,7 +90,8 @@ return; } - return $this->uri_base( $p_repo ) . 'a=blob;f=' . $p_file->filename . ';h=' . $p_changeset->revision; + return $this->uri_base( $p_repo ) . 'a=blob;f=' . $p_file->filename . + ';h=' . $p_file->revision . ';hb=' . $p_changeset->revision; } function url_diff( $p_event, $p_repo, $p_changeset, $p_file ) { @@ -98,7 +99,8 @@ return; } - return $this->uri_base( $p_repo ) . 'a=blobdiff;f=' . $p_file->filename . ';h=' . $p_changeset->revision; + return $this->uri_base( $p_repo ) . 'a=blobdiff;f=' . $p_file->filename . + ';h=' . $p_file->revision . ';hb=' . $p_changeset->revision . ';hpb=' . $p_changeset->parent; } function update_repo_form( $p_event, $p_repo ) { @@ -208,15 +210,15 @@ echo "Retrieving $t_commit_id ... "; - $t_uri = $p_uri_base . 'commit/' . $t_commit_id; - $t_json = json_url( $t_uri, 'commit' ); + $t_commit_url = $this->uri_base( $p_repo ) . 'a=commit;h=' . $t_commit_id; + $t_input = url_get( $t_commit_url ); - if ( false === $t_json ) { + if ( false === $t_input ) { echo "failed.\n"; continue; } - $t_commit_parents = $this->json_commit_changeset( $p_repo, $t_json, $p_branch ); + $t_commit_parents = $this->commit_changeset( $p_repo, $t_input, $p_branch ); $t_parents = array_merge( $t_parents, $t_commit_parents ); } @@ -224,34 +226,83 @@ return true; } - function json_commit_changeset( $p_repo, $p_json, $p_branch='' ) { + function commit_changeset( $p_repo, $p_input, $p_branch='' ) { - echo "processing $p_json->id ... "; - if ( !SourceChangeset::exists( $p_repo->id, $p_json->id ) ) { - $t_user_id = user_get_id_by_email( $p_json->author->email ); + $t_input = str_replace( array(PHP_EOL, '<', '>'), array('', '<', '>'), $p_input ); + + # Exract sections of commit data and changed files + if( ! preg_match( '#