Added the display of the commit parents in the changelog view.
The old commits will not have the parents displayed as already cached in the DB, but the new will get them.
This commit is contained in:
parent
390c9b5048
commit
116a7e34db
@ -34,6 +34,7 @@ Pluf::loadFunction('Pluf_Template_dateAgo');
|
|||||||
class IDF_Commit extends Pluf_Model
|
class IDF_Commit extends Pluf_Model
|
||||||
{
|
{
|
||||||
public $_model = __CLASS__;
|
public $_model = __CLASS__;
|
||||||
|
public $extra = null; /**< Extra data as IDF_Gconf object */
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
@ -143,6 +144,10 @@ class IDF_Commit extends Pluf_Model
|
|||||||
array($project->id, $change->commit));
|
array($project->id, $change->commit));
|
||||||
$r = Pluf::factory('IDF_Commit')->getList(array('filter'=>$sql->gen()));
|
$r = Pluf::factory('IDF_Commit')->getList(array('filter'=>$sql->gen()));
|
||||||
if ($r->count() > 0) {
|
if ($r->count() > 0) {
|
||||||
|
$r[0]->extra = new IDF_Gconf();
|
||||||
|
$r[0]->extra->serialize = true;
|
||||||
|
$r[0]->extra->setModel($r[0]);
|
||||||
|
$r[0]->extra->initCache();
|
||||||
return $r[0];
|
return $r[0];
|
||||||
}
|
}
|
||||||
if (!isset($change->full_message)) {
|
if (!isset($change->full_message)) {
|
||||||
@ -158,6 +163,13 @@ class IDF_Commit extends Pluf_Model
|
|||||||
$commit->origauthor = $change->author;
|
$commit->origauthor = $change->author;
|
||||||
$commit->creation_dtime = $change->date;
|
$commit->creation_dtime = $change->date;
|
||||||
$commit->create();
|
$commit->create();
|
||||||
|
$extra = $scm->getExtraProperties($change);
|
||||||
|
$commit->extra = new IDF_Gconf();
|
||||||
|
$commit->extra->serialize = true; // As we can store arrays
|
||||||
|
$commit->extra->setModel($commit);
|
||||||
|
foreach ($extra as $key => $val) {
|
||||||
|
$commit->extra->setVal($key, $val);
|
||||||
|
}
|
||||||
$commit->notify($project->getConf());
|
$commit->notify($project->getConf());
|
||||||
return $commit;
|
return $commit;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,10 @@ class IDF_Gconf extends Pluf_Model
|
|||||||
public $dirty = array();
|
public $dirty = array();
|
||||||
public $f = null;
|
public $f = null;
|
||||||
protected $_mod = null;
|
protected $_mod = null;
|
||||||
|
/**
|
||||||
|
* Do we (un)serialize the data when getting/setting them.
|
||||||
|
*/
|
||||||
|
public $serialize = false;
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
@ -97,7 +101,7 @@ class IDF_Gconf extends Pluf_Model
|
|||||||
$sql = new Pluf_SQL('model_class=%s AND model_id=%s',
|
$sql = new Pluf_SQL('model_class=%s AND model_id=%s',
|
||||||
array($this->_mod->_model, $this->_mod->id));
|
array($this->_mod->_model, $this->_mod->id));
|
||||||
foreach ($this->getList(array('filter' => $sql->gen())) as $val) {
|
foreach ($this->getList(array('filter' => $sql->gen())) as $val) {
|
||||||
$this->datacache[$val->vkey] = $val->vdesc;
|
$this->datacache[$val->vkey] = ($this->serialize) ? unserialize($val->vdesc) : $val->vdesc;
|
||||||
$this->dirty[$val->vkey] = $val->id;
|
$this->dirty[$val->vkey] = $val->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,11 +116,12 @@ class IDF_Gconf extends Pluf_Model
|
|||||||
and $value == $this->getVal($key)) {
|
and $value == $this->getVal($key)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$svalue = ($this->serialize) ? serialize($value) : $value;
|
||||||
if (isset($this->dirty[$key])) {
|
if (isset($this->dirty[$key])) {
|
||||||
// we get to check if deleted by other process + update
|
// we get to check if deleted by other process + update
|
||||||
$conf = new IDF_Gconf($this->dirty[$key]);
|
$conf = new IDF_Gconf($this->dirty[$key]);
|
||||||
if ($conf->id == $this->dirty[$key]) {
|
if ($conf->id == $this->dirty[$key]) {
|
||||||
$conf->vdesc = $value;
|
$conf->vdesc = $svalue;
|
||||||
$conf->update();
|
$conf->update();
|
||||||
$this->datacache[$key] = $value;
|
$this->datacache[$key] = $value;
|
||||||
return;
|
return;
|
||||||
@ -127,7 +132,7 @@ class IDF_Gconf extends Pluf_Model
|
|||||||
$conf->model_class = $this->_mod->_model;
|
$conf->model_class = $this->_mod->_model;
|
||||||
$conf->model_id = $this->_mod->id;
|
$conf->model_id = $this->_mod->id;
|
||||||
$conf->vkey = $key;
|
$conf->vkey = $key;
|
||||||
$conf->vdesc = $value;
|
$conf->vdesc = $svalue;
|
||||||
$conf->create();
|
$conf->create();
|
||||||
$this->datacache[$key] = $value;
|
$this->datacache[$key] = $value;
|
||||||
$this->dirty[$key] = $conf->id;
|
$this->dirty[$key] = $conf->id;
|
||||||
|
@ -420,6 +420,21 @@ class IDF_Scm
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a changelog parsed node, returns extra data.
|
||||||
|
*
|
||||||
|
* For example, if the node is a commit object from git, it will a
|
||||||
|
* stdClass object with the parents array. The extra value could
|
||||||
|
* then be the parent(s) commit(s).
|
||||||
|
*
|
||||||
|
* @param stdClass Commit object/Parse object
|
||||||
|
* @return array Extra properties
|
||||||
|
*/
|
||||||
|
public function getExtraProperties($obj)
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a zip archive at a given commit, wrapped in a HTTP response, suitable for pushing to client.
|
* Generate a zip archive at a given commit, wrapped in a HTTP response, suitable for pushing to client.
|
||||||
*
|
*
|
||||||
|
@ -116,6 +116,14 @@ class IDF_Scm_Git extends IDF_Scm
|
|||||||
return $this->_inObject($commit, 'branch');
|
return $this->_inObject($commit, 'branch');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will find the parents if available.
|
||||||
|
*/
|
||||||
|
public function getExtraProperties($obj)
|
||||||
|
{
|
||||||
|
return (isset($obj->parents)) ? array('parents' => $obj->parents) : array();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IDF_Scm::getTags()
|
* @see IDF_Scm::getTags()
|
||||||
**/
|
**/
|
||||||
|
@ -13,7 +13,18 @@
|
|||||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $change.scm_id)}
|
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $change.scm_id)}
|
||||||
<tr class="log">
|
<tr class="log">
|
||||||
<td class="nobrk"><a href="{$url}">{$change.creation_dtime|dateago:"without"}</a></td>
|
<td class="nobrk"><a href="{$url}">{$change.creation_dtime|dateago:"without"}</a></td>
|
||||||
<td>{issuetext $change.summary, $request}{if $change.fullmessage}<br /><br />{issuetext $change.fullmessage, $request, true, false, true, true, true}{/if}</td>
|
<td>{issuetext $change.summary, $request}{if $change.fullmessage}<br /><br />{issuetext $change.fullmessage, $request, true, false, true, true, true}{/if}
|
||||||
|
|
||||||
|
|
||||||
|
{assign $parents = $change.extra.getVal('parents')}
|
||||||
|
|
||||||
|
{if count($parents) > 1}<div class="helptext">
|
||||||
|
{foreach $parents as $parent}<br />
|
||||||
|
{trans 'Parent:'} <a href="{url 'IDF_Views_Source::commit', array($project.shortname, $parent)}" title="{trans 'View corresponding commit'}" class="mono">{$parent}</a>
|
||||||
|
{/foreach}</div>{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="extra">
|
<tr class="extra">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
|
Loading…
Reference in New Issue
Block a user