Add git commit support.

This commit is contained in:
Darko
2015-06-19 08:59:30 +02:00
parent 456a67ec8c
commit 15fcc91dfe
2 changed files with 75 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see LICENSE.txt in the base directory. If
* not, see:
*
* @link <http://www.gnu.org/licenses/>.
* @author niel
* @copyright 2015 nZEDb
*/
require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'config.php';
use newznab\db\DbUpdate;
use newznab\utility\Git;
use newznab\utility\Utility;
if (!Utility::isCLI()) {
exit;
}
$error = false;
$git = new Git();
$branch = $git->active_branch();
if (in_array($branch, $git->mainBranches())) {
// Only update patches, etc. on specific branches to lessen conflicts
try {
// Run DbUpdates to make sure we're up to date.
$DbUpdater = new DbUpdate(['git' => $git]);
$DbUpdater->newPatches(['safe' => false]);
} catch (\Exception $e) {
$error = 1;
echo "Error while checking patches!\n";
echo $e->getMessage() . "\n";
}
}
exit($error);
?>
+24
View File
@@ -0,0 +1,24 @@
#!/bin/sh
EXIT_STATUS=0
# Add changes.
git add -i
# Edit changelog.
nano Changelog
# Add changes to changelog.
git add Changelog
php build/NewPatches.php
EXIT_STATUS="$?"
if [ ${EXIT_STATUS} -gt 0 ]
then
echo "\nProblem while converting SQL patch files!\n";
exit ${EXIT_STATUS}
fi
# Commit changes.
git commit