<commit_before><?php

# Copyright (c) 2014 <NAME>
# Copyright (c) 2014 <NAME>
# Licensed under the MIT license

if ( false === include_once( config_get( 'plugin_path' ) . 'Source/MantisSourcePlugin.class.php' ) ) {
	return;
}

require_once( config_get( 'core_path' ) . 'url_api.php' );
require_once( config_get( 'core_path' ) . 'json_api.php' );

class SourceGitlabPlugin extends MantisSourcePlugin {
	public function register() {
		$this->name = plugin_lang_get( 'title' );
		$this->description = plugin_lang_get( 'description' );

		$this->version = '1.0.1';
		$this->requires = array(
			'MantisCore' => '1.2.0',
			'Source' => '0.16',
		);

		$this->author = '<NAME>';
		$this->contact = '<EMAIL>';
		$this->url = 'http://www.mobilexag.de';
	}

	public $type = 'gitlab';

	public function show_type() {
		return plugin_lang_get( 'gitlab' );
	}

	public function show_changeset( $p_repo, $p_changeset ) {
		$t_ref = substr( $p_changeset->revision, 0, 8 );
		$t_branch = $p_changeset->branch;

		return "$t_branch $t_ref";
	}

	public function show_file( $p_repo, $p_changeset, $p_file ) {
		return  "$p_file->action - $p_file->filename";
	}

	public function url_repo( $p_repo, $p_changeset=null ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = "";

		if ( !is_null( $p_changeset ) ) {
			$t_ref = "/$p_changeset->revision";
		}
		if ( !is_null( $t_ref ) ) {
			return "$t_root/$t_reponame/";
		}
		return "$t_root/$t_reponame/tree/$t_ref";
	}

	public function url_changeset( $p_repo, $p_changeset ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;

		return "$t_root/$t_reponame/commit/$t_ref";
	}

	public function url_file( $p_repo, $p_changeset, $p_file ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;
		$t_filename = $p_file->filename;

		return "$t_root/$t_reponame/blob/$t_ref/$t_filename";
	}

	public function url_diff( $p_repo, $p_changeset, $p_file ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;
		$t_filename = $p_file->filename;

		return "t_root/$t_reponame/commit/$t_ref?view=parallel";
	}

public function update_repo_form( $p_repo ) {
		$t_hub_root = null;
		$t_hub_repoid = null;
		$t_hub_app_secret = null;

		if ( isset( $p_repo->info['hub_root'] ) ) {
			$t_hub_root = $p_repo->info['hub_root'];
		}
		if ( isset( $p_repo->info['hub_repoid'] ) ) {
			$t_hub_repoid = $p_repo->info['hub_repoid'];
		}
		if ( isset( $p_repo->info['hub_reponame'] ) ) {
			$t_hub_reponame = $p_repo->info['hub_reponame'];
		}
		if ( isset( $p_repo->info['hub_app_secret'] ) ) {
			$t_hub_app_secret = $p_repo->info['hub_app_secret'];
		}
		if ( isset( $p_repo->info['master_branch'] ) ) {
			$t_master_branch = $p_repo->info['master_branch'];
		} else {
			$t_master_branch = 'master';<commit_msg>Gitlab: Add missing '$' in url_diff()<commit_after><?php

# Copyright (c) 2014 <NAME>
# Copyright (c) 2014 <NAME>
# Licensed under the MIT license

if ( false === include_once( config_get( 'plugin_path' ) . 'Source/MantisSourcePlugin.class.php' ) ) {
	return;
}

require_once( config_get( 'core_path' ) . 'url_api.php' );
require_once( config_get( 'core_path' ) . 'json_api.php' );

class SourceGitlabPlugin extends MantisSourcePlugin {
	public function register() {
		$this->name = plugin_lang_get( 'title' );
		$this->description = plugin_lang_get( 'description' );

		$this->version = '1.0.1';
		$this->requires = array(
			'MantisCore' => '1.2.0',
			'Source' => '0.16',
		);

		$this->author = '<NAME>';
		$this->contact = '<EMAIL>.<EMAIL>';
		$this->url = 'http://www.mobilexag.de';
	}

	public $type = 'gitlab';

	public function show_type() {
		return plugin_lang_get( 'gitlab' );
	}

	public function show_changeset( $p_repo, $p_changeset ) {
		$t_ref = substr( $p_changeset->revision, 0, 8 );
		$t_branch = $p_changeset->branch;

		return "$t_branch $t_ref";
	}

	public function show_file( $p_repo, $p_changeset, $p_file ) {
		return  "$p_file->action - $p_file->filename";
	}

	public function url_repo( $p_repo, $p_changeset=null ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = "";

		if ( !is_null( $p_changeset ) ) {
			$t_ref = "/$p_changeset->revision";
		}
		if ( !is_null( $t_ref ) ) {
			return "$t_root/$t_reponame/";
		}
		return "$t_root/$t_reponame/tree/$t_ref";
	}

	public function url_changeset( $p_repo, $p_changeset ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;

		return "$t_root/$t_reponame/commit/$t_ref";
	}

	public function url_file( $p_repo, $p_changeset, $p_file ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;
		$t_filename = $p_file->filename;

		return "$t_root/$t_reponame/blob/$t_ref/$t_filename";
	}

	public function url_diff( $p_repo, $p_changeset, $p_file ) {
		$t_root = $p_repo->info['hub_root'];
		$t_reponame = $p_repo->info['hub_reponame'];
		$t_ref = $p_changeset->revision;
		$t_filename = $p_file->filename;

		return "$t_root/$t_reponame/commit/$t_ref?view=parallel";
	}

public function update_repo_form( $p_repo ) {
		$t_hub_root = null;
		$t_hub_repoid = null;
		$t_hub_app_secret = null;

		if ( isset( $p_repo->info['hub_root'] ) ) {
			$t_hub_root = $p_repo->info['hub_root'];
		}
		if ( isset( $p_repo->info['hub_repoid'] ) ) {
			$t_hub_repoid = $p_repo->info['hub_repoid'];
		}
		if ( isset( $p_repo->info['hub_reponame'] ) ) {
			$t_hub_reponame = $p_repo->info['hub_reponame'];
		}
		if ( isset( $p_repo->info['hub_app_secret'] ) ) {
			$t_hub_app_secret = $p_repo->info['hub_app_secret'];
		}
		if ( isset( $p_repo->info['master_branch'] ) ) {
			$t_master_branch = $p_repo->info['master_branch'];
		} else {
			$t_master_branch = 'master';
{'fraction_non_alphanumeric': 0.18769794965827638, 'fraction_numerical': 0.006334389064844141, 'mean_word_length': 4.429864253393665, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 86, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5297958', 'n_tokens_mistral': 2687, 'n_tokens_neox': 2499, 'n_words': 391}