Output the branch a particular commit is on; this is easy for
mercurial and monotone, but slightly harder till impossible to do properly for git and svn. Please review and eventually adapt the code to make it work better (partially fixes issue 450)
This commit is contained in:
parent
ad15b13f7e
commit
70e8d12420
@ -436,6 +436,8 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
$out = self::parseLog($out);
|
||||
$out[0]->changes = '';
|
||||
}
|
||||
|
||||
$out[0]['branch'] = $this->inBranches($commit, null);
|
||||
return $out[0];
|
||||
}
|
||||
|
||||
|
@ -429,6 +429,8 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
$c['author'] = $match[2];
|
||||
} elseif ($match[1] == 'summary') {
|
||||
$c['title'] = $match[2];
|
||||
} elseif ($match[1] == 'branch') {
|
||||
$c['branch'] = $match[2];
|
||||
} else {
|
||||
$c[$match[1]] = trim($match[2]);
|
||||
}
|
||||
@ -443,6 +445,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
}
|
||||
}
|
||||
$c['tree'] = !empty($c['commit']) ? trim($c['commit']) : '';
|
||||
$c['branch'] = empty($c['branch']) ? 'default' : $c['branch'];
|
||||
$c['full_message'] = !empty($c['full_message']) ? trim($c['full_message']) : '';
|
||||
$res[] = (object) $c;
|
||||
return $res;
|
||||
|
@ -141,12 +141,12 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
public function getArchiveStream($commit, $prefix='repository/')
|
||||
{
|
||||
$revs = $this->_resolveSelector($commit);
|
||||
// sanity: this should actually not happen, because the
|
||||
// sanity: this should actually not happen, because the
|
||||
// revision is validated before already
|
||||
if (count($revs) == 0) {
|
||||
return new Pluf_HTTP_Response_NotFound();
|
||||
}
|
||||
return new IDF_Scm_Monotone_ZipRender($this->stdio, $revs[0]);
|
||||
return new IDF_Scm_Monotone_ZipRender($this->stdio, $revs[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,7 +174,7 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
$cache = Pluf_Cache::factory();
|
||||
$cachekey = 'mtn-plugin-certs-for-rev-' . $rev;
|
||||
$certs = $cache->get($cachekey);
|
||||
|
||||
|
||||
if ($certs === null) {
|
||||
$out = $this->stdio->exec(array('certs', $rev));
|
||||
|
||||
@ -545,7 +545,7 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
|
||||
if ($stanza[0]['values'][0] != $file)
|
||||
continue;
|
||||
|
||||
|
||||
$file = $this->_fillFileEntry($stanza);
|
||||
return (object) $file;
|
||||
}
|
||||
@ -623,7 +623,9 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
$res['title'] = $split[0];
|
||||
$res['full_message'] = (isset($split[1])) ? trim($split[1]) : '';
|
||||
|
||||
$res['branch'] = implode(', ', $certs['branch']);
|
||||
$res['commit'] = $revs[0];
|
||||
|
||||
$res['changes'] = ($getdiff) ? $this->_getDiff($revs[0]) : '';
|
||||
|
||||
return (object) $res;
|
||||
@ -682,7 +684,7 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
__("revision %s has no branch cert - cannot start ".
|
||||
"logging from this revision"), $rev
|
||||
));
|
||||
}
|
||||
}
|
||||
$initialBranches = $certs['branch'];
|
||||
}
|
||||
|
||||
|
@ -415,6 +415,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
$res['commit'] = (string) $xml->logentry['revision'];
|
||||
$res['changes'] = ($getdiff) ? $this->getDiff($commit) : '';
|
||||
$res['tree'] = '';
|
||||
$res['branch'] = '';
|
||||
return (object) $res;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,9 @@
|
||||
<th><strong>{trans 'Author:'}</strong></th><td>{showuser $rcommit.get_author(), $request, $cobject.author}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{trans 'Branch:'}</strong></th><td>{$cobject.branch}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{trans 'Commit:'}</strong></th><td class="mono"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}" title="{trans 'View corresponding source tree'}">{$cobject.commit}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Loading…
Reference in New Issue
Block a user