diff --git a/SourceCgit/LICENSE b/SourceCgit/LICENSE
new file mode 100644
index 0000000..4aa85f8
--- /dev/null
+++ b/SourceCgit/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) 2011 John Reese and asm89
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/SourceCgit/SourceCgit.php b/SourceCgit/SourceCgit.php
new file mode 100644
index 0000000..518993a
--- /dev/null
+++ b/SourceCgit/SourceCgit.php
@@ -0,0 +1,373 @@
+name = plugin_lang_get( 'title' );
+ $this->description = plugin_lang_get( 'description' );
+
+ $this->version = '0.16';
+ $this->requires = array(
+ 'MantisCore' => '1.2.0',
+ 'Source' => '0.16',
+ 'Meta' => '0.1',
+ );
+
+ $this->author = 'Alexander';
+ $this->contact = 'iam.asm89@gmail.com';
+ $this->url = '-';
+ }
+
+ public $type = 'cgit';
+
+ public function show_type() {
+ return plugin_lang_get( 'cgit' );
+ }
+
+ 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";
+ }
+
+ private function uri_base( $p_repo ) {
+ $t_uri_base = $p_repo->info['cgit_root'] . '' . $p_repo->info['cgit_project'] . '/';
+
+ return $t_uri_base;
+ }
+
+ public function url_repo( $p_repo, $t_changeset=null ) {
+ return $this->uri_base( $p_repo ) . ( $t_changeset ? 'commit/?id=' . $t_changeset->revision : '' );
+ }
+
+ public function url_commit ( $p_repo, $commit_rev) {
+ return $this->uri_base( $p_repo ) . 'commit/?id=' . $commit_rev;
+ }
+
+ public function url_changeset( $p_repo, $p_changeset ) {
+ return $this->uri_base( $p_repo ) . ( $p_changeset ? 'commit/?id=' . $p_changeset->revision : '' );
+ }
+
+ public function url_file( $p_repo, $p_changeset, $p_file ) {
+ return $this->uri_base( $p_repo ) . 'tree/' . $p_file->filename . '?id=' . $p_changeset->revision;
+ }
+
+ public function url_diff( $p_repo, $p_changeset, $p_file ) {
+ return $this->uri_base( $p_repo ) . 'diff/' . $p_file->filename . '?id=' . $p_changeset->revision;
+
+ }
+
+ public function update_repo_form( $p_repo ) {
+ $t_gitweb_root = null;
+ $t_gitweb_project = null;
+
+ if ( isset( $p_repo->info['cgit_root'] ) ) {
+ $t_cgit_root = $p_repo->info['cgit_root'];
+ }
+
+ if ( isset( $p_repo->info['cgit_project'] ) ) {
+ $t_cgit_project = $p_repo->info['cgit_project'];
+ }
+
+ if ( isset( $p_repo->info['master_branch'] ) ) {
+ $t_master_branch = $p_repo->info['master_branch'];
+ } else {
+ $t_master_branch = 'master';
+ }
+?>
+
>
+
+
+
+
>
+
+
+
+
>
+
+
+
+info['cgit_root'] = $f_cgit_root;
+ $p_repo->info['cgit_project'] = $f_cgit_project;
+ $p_repo->info['master_branch'] = $f_master_branch;
+
+ return $p_repo;
+ }
+
+ public function precommit( ) {
+ # TODO: Implement real commit sequence.
+ return;
+ }
+
+ public function commit( $p_repo, $p_data ) {
+ # The -d option from curl requires you to encode your own data.
+ # Once it reaches here it is decoded. Hence we split by a space
+ # were as the curl command uses a '+' character instead.
+ # i.e. DATA=`echo $INPUT | sed -e 's/ /+/g'`
+ list ( , $t_commit_id, $t_branch) = split(' ', $p_data);
+ list ( , , $t_branch) = split('/', $t_branch);
+ if ($t_branch != $p_repo->info['master_branch'])
+ {
+ return;
+ }
+
+ return $this->import_commits($p_repo, null, $t_commit_id, $t_branch);
+ }
+
+ public function import_full( $p_repo ) {
+ echo '