33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-02-14 01:30:21 +00:00

Add a PR's branch (based on the PR- label) (Ref #191)

This commit is contained in:
Michael Babker 2017-04-22 11:28:43 -05:00
parent 7f4cdbe86c
commit c2f233d572
14 changed files with 34 additions and 5 deletions

View File

@ -338,16 +338,19 @@ class PullsModel extends \JModelDatabase
{
if (isset($pull->pull_request))
{
// Check if this PR is RTC
$isRTC = false;
// Check if this PR is RTC and has a `PR-` branch label
$isRTC = false;
$branch = '';
foreach ($pull->labels as $label)
{
if ($label->name === 'RTC')
{
$isRTC = true;
break;
}
elseif (substr($label->name, 0, 3) === 'PR-')
{
$branch = substr($label->name, 3);
}
}
@ -358,6 +361,7 @@ class PullsModel extends \JModelDatabase
$this->getDb()->quote(\JHtml::_('string.truncate', $pull->body, 100)),
$this->getDb()->quote($pull->pull_request->html_url),
(int) $isRTC,
$this->getDb()->quote($branch),
);
$data[] = implode($pullData, ',');
@ -373,7 +377,7 @@ class PullsModel extends \JModelDatabase
$this->getDb()->setQuery(
$this->getDb()->getQuery(true)
->insert('#__patchtester_pulls')
->columns(array('pull_id', 'title', 'description', 'pull_url', 'is_rtc'))
->columns(array('pull_id', 'title', 'description', 'pull_url', 'is_rtc', 'branch'))
->values($data)
);

View File

@ -82,6 +82,9 @@ $colSpan = $this->trackerAlias !== false ? 7 : 6;
<th class="nowrap">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
</th>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>

View File

@ -27,6 +27,9 @@ foreach ($this->items as $i => $item) :
</div>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="center">
<?php if ($item->is_rtc) : ?>
<span class="label label-success"><?php echo \JText::_('JYES'); ?></span>

View File

@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `#__patchtester_pulls` (
`pull_url` varchar(255) NOT NULL,
`sha` varchar(40) NOT NULL DEFAULT '',
`is_rtc` tinyint(1) NOT NULL DEFAULT 0,
`branch` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS "#__patchtester_pulls" (
"pull_url" character varying(255) NOT NULL,
"sha" character varying(40) DEFAULT '' NOT NULL,
"is_rtc" smallint DEFAULT 1 NOT NULL,
"branch" character varying(255) DEFAULT '' NOT NULL,
PRIMARY KEY ("id")
);

View File

@ -6,6 +6,7 @@ CREATE TABLE [#__patchtester_pulls] (
[pull_url] [nvarchar](255) NOT NULL,
[sha] [nvarchar](40) NOT NULL DEFAULT '',
[is_rtc] [smallint] NOT NULL DEFAULT 1,
[branch] [nvarchar](255) NOT NULL DEFAULT '',
CONSTRAINT [PK_#__patchtester_pulls] PRIMARY KEY CLUSTERED
(
[id] ASC

View File

@ -0,0 +1 @@
ALTER TABLE `#__patchtester_pulls` ADD COLUMN `branch` varchar(255) NOT NULL DEFAULT '' AFTER `is_rtc`;

View File

@ -0,0 +1 @@
ALTER TABLE "#__patchtester_pulls" ADD COLUMN "branch" character varying(255) DEFAULT '' NOT NULL;

View File

@ -0,0 +1 @@
ALTER TABLE [#__patchtester_pulls] ADD [branch] [nvarchar](255) NOT NULL DEFAULT '';

View File

@ -11,6 +11,7 @@ COM_PATCHTESTER_APPLIED="Applied"
COM_PATCHTESTER_APPLIED_COMMIT_SHA="Applied Commit SHA: %s"
COM_PATCHTESTER_APPLY_OK="Patch successfully applied"
COM_PATCHTESTER_APPLY_PATCH="Apply Patch"
COM_PATCHTESTER_BRANCH="Branch"
COM_PATCHTESTER_CONFIGURATION="Joomla! Patch Tester Settings"
COM_PATCHTESTER_CONFIRM_RESET="Resetting will attempt to revert all applied patches and removes all backed up files. This may result in a corrupted environment. Are you sure you want to continue?"
COM_PATCHTESTER_CONFLICT_S="The patch could not be applied because it conflicts with a previously applied patch: %s"

View File

@ -101,6 +101,9 @@ $colSpan = $this->trackerAlias !== false ? 7 : 6;
<th class="nowrap">
<?php echo \JText::_('JGLOBAL_TITLE'); ?>
</th>
<th width="8%" class="nowrap text-center">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap text-center">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>

View File

@ -27,6 +27,9 @@ foreach ($this->items as $i => $item) :
</div>
<?php endif; ?>
</td>
<td class="text-center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="text-center">
<?php if ($item->is_rtc) : ?>
<span class="badge badge-success"><?php echo \JText::_('JYES'); ?></span>

View File

@ -72,6 +72,9 @@ echo \JHtml::_(
<th class="nowrap">
<?php echo \JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
</th>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_BRANCH'); ?>
</th>
<th width="8%" class="nowrap center">
<?php echo \JText::_('COM_PATCHTESTER_READY_TO_COMMIT'); ?>
</th>

View File

@ -29,6 +29,9 @@ foreach ($this->items as $i => $item) :
</p>
<?php endif; ?>
</td>
<td class="center">
<?php echo $this->escape($item->branch); ?>
</td>
<td class="center">
<?php if ($item->is_rtc) : ?>
<span class="label label-success"><?php echo \JText::_('JYES'); ?></span>