From d2f0bac907e82ee394ada3db603354223cbc317f Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Tue, 29 Jun 2010 09:59:49 +0200 Subject: [PATCH] * Monotone.php: get inTags() and inBranches() correct - they need to return a list with selectors as keys, otherwise the main menu won't link the active revision, but instead use the main branch * changelog.html, tree.html: shorten the branch / tag output a bit (still ugly to have a fixed output like this, though), link tags by their selector, no longer by their revision ID. We loose some flexibility here, since tags could actually mark different revisions, which are now ignored --- src/IDF/Scm/Monotone.php | 22 +++++++++++++------ .../templates/idf/source/mtn/changelog.html | 8 +++---- src/IDF/templates/idf/source/mtn/tree.html | 10 ++++----- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index 4fac426..de061b4 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -628,13 +628,14 @@ class IDF_Scm_Monotone extends IDF_Scm /** * Returns unique certificate values for the given revs and the specific - * cert name + * cert name, optionally prefixed with $prefix * * @param array * @param string + * @param string * @return array */ - private function _getUniqueCertValuesFor($revs, $certName) + private function _getUniqueCertValuesFor($revs, $certName, $prefix) { $certValues = array(); foreach ($revs as $rev) @@ -642,8 +643,10 @@ class IDF_Scm_Monotone extends IDF_Scm $certs = $this->_getCerts($rev); if (!array_key_exists($certName, $certs)) continue; - - $certValues = array_merge($certValues, $certs[$certName]); + foreach ($certs[$certName] as $certValue) + { + $certValues[] = "$prefix$certValue"; + } } return array_unique($certValues); } @@ -686,7 +689,7 @@ class IDF_Scm_Monotone extends IDF_Scm { $revs = $this->_resolveSelector($commit); if (count($revs) == 0) return array(); - return $this->_getUniqueCertValuesFor($revs, "branch"); + return $this->_getUniqueCertValuesFor($revs, "branch", "h:"); } /** @@ -716,7 +719,12 @@ class IDF_Scm_Monotone extends IDF_Scm } if ($stanzaline['key'] == "revision") { - $tags[$stanzaline['hash']] = $tagname; + // FIXME: warn if multiple revisions have + // equally named tags + if (!array_key_exists("t:$tagname", $tags)) + { + $tags["t:$tagname"] = $tagname; + } break; } } @@ -733,7 +741,7 @@ class IDF_Scm_Monotone extends IDF_Scm { $revs = $this->_resolveSelector($commit); if (count($revs) == 0) return array(); - return $this->_getUniqueCertValuesFor($revs, "tag"); + return $this->_getUniqueCertValuesFor($revs, "tag", "t:"); } /** diff --git a/src/IDF/templates/idf/source/mtn/changelog.html b/src/IDF/templates/idf/source/mtn/changelog.html index 449c88c..5747ea4 100644 --- a/src/IDF/templates/idf/source/mtn/changelog.html +++ b/src/IDF/templates/idf/source/mtn/changelog.html @@ -3,9 +3,9 @@

{trans 'Branches:'}
{foreach $branches as $selector => $branch} {aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $selector)} - + - {$branch|shorten:25} + {$branch|shorten:24}
{/foreach} @@ -14,9 +14,9 @@

{trans 'Tags:'}
{foreach $tags as $selector => $tag} {aurl 'url', 'IDF_Views_Source::changeLog', array($project.shortname, $selector)} - + - {$tag|shorten:25} + {$tag|shorten:24}
{/foreach} diff --git a/src/IDF/templates/idf/source/mtn/tree.html b/src/IDF/templates/idf/source/mtn/tree.html index 51cf8d3..20b7622 100644 --- a/src/IDF/templates/idf/source/mtn/tree.html +++ b/src/IDF/templates/idf/source/mtn/tree.html @@ -35,7 +35,7 @@ {$file.file}{else}{$file.file}{/if} {if $file.type == 'blob'} {if isset($file.date) and $file.log != '----'} -{$file.date|dateago:"wihtout"} +{$file.date|dateago:"without"} {$file.author|strip_tags|trim}{trans ':'} {issuetext $file.log, $request, true, false} {else}{/if} {$file.size|size}{/if} @@ -58,9 +58,9 @@

{trans 'Branches:'}
{foreach $branches as $selector => $branch} {aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} - + - {$branch|shorten:25} + {$branch|shorten:24}
{/foreach} @@ -69,9 +69,9 @@

{trans 'Tags:'}
{foreach $tags as $selector => $tag} {aurl 'url', 'IDF_Views_Source::treeBase', array($project.shortname, $selector)} - + - {$tag|shorten:25} + {$tag|shorten:24}
{/foreach}