<?php
error_reporting(E_ALL | E_STRICT);
ini_set("track_errors", "On");
$INC = "../inc";
require_once($INC . "/init.inc.php");
require_once($INC . "/bug.inc.php");
require_once($INC . "/sql.inc.php");
require_once($INC . "/struct.inc.php");
rg_log_set_file("bug.log");
$rg_sql_debug = 1;
$db = rg_sql_open("dbname=trg");
if ($db === FALSE) {
rg_log("Cannot create a database (" . rg_sql_error() . ")!");
exit(1);
}
$r = rg_sql_struct_update($db, RG_DROP_TABLES|RG_IGNORE_ERRORS);
if ($r !== TRUE) {
rg_log("Cannot create struct (" . rg_sql_error() . ")!");
exit(1);
}
// defaults
$repo_id = 100;
$uid = 1;
$data = array("title" => "Bug title",
"body" => "This is the body\nof the\nbug. <>",
"labels" => "label1,label2,label3",
"state" => 1,
"assigned_uid" => 6);
$r = rg_bug_add($db, $repo_id, $uid, $data);
if ($r === FALSE) {
rg_log("Cannot insert a bug (" . rg_bug_error() . ")!");
exit(1);
}
$bug_id = $r;
$uid = 10;
$data = array("note" => "This is just a note.");
$r = rg_bug_note_add($db, $repo_id, $bug_id, $uid, $data);
if ($r === FALSE) {
rg_log("Cannot add a note (" . rg_bug_error() . ")!");
exit(1);
}
$r = rg_bug_info($db, $repo_id, $bug_id);
if ($r === FALSE) {
rg_log("Cannot lookup a bug (" . rg_bug_error() . ")!");
exit(1);
}
if ($r['exists'] != 1) {
rg_log("Seems the bug does not exists!");
exit(1);
}
// test a non existing bug
$r = rg_bug_info($db, $repo_id, 0);
if ($r === FALSE) {
rg_log("Cannot lookup a bug (" . rg_bug_error() . ")!");
exit(1);
}
if ($r['exists'] != 0) {
rg_log("Wrong bug number (0) returned valid data!");
exit(1);
}
rg_sql_close($db);
echo "bug: OK!\n";
?>
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master