diff --git a/NEWS.mdtext b/NEWS.mdtext index 8820900..9251896 100644 --- a/NEWS.mdtext +++ b/NEWS.mdtext @@ -4,12 +4,14 @@ - Mercurial source views now show parent revisions (if any) and detailed change information - File download URLs now contain the file name rather than the upload id; old links still work though (issue 686) +- Display monotone file and directory attributes in the tree and file view + (needs a monotone with an interface version of 13.1 or newer) -## Bugfixes +## Bugfixes - monotone zip archive entries now all carry the revision date as mtime (issue 645) - Timeline only displays filter options for items a user has actually access to (issue 655) -- The log, tags and branches parsers for Mercurial are more robust now (issue 663) +- The log, tags and branches parsers for Mercurial are more robust now (issue 663) - Fix SSH public key parsing issues and improve the check for existing, uploaded keys (issue 679) - Let the SVN command line client not store the login credentials we give him as arguments diff --git a/src/IDF/Scm/Monotone.php b/src/IDF/Scm/Monotone.php index d75fa6d..d04c53b 100644 --- a/src/IDF/Scm/Monotone.php +++ b/src/IDF/Scm/Monotone.php @@ -31,10 +31,10 @@ class IDF_Scm_Monotone extends IDF_Scm /** the minimum supported interface version */ public static $MIN_INTERFACE_VERSION = 13.0; - private $stdio; - private static $instances = array(); + private $stdio; + /** * Constructor */ @@ -699,6 +699,29 @@ class IDF_Scm_Monotone extends IDF_Scm } /** + * @see IDF_Scm::getProperties() + */ + public function getProperties($rev, $path='') + { + $out = $this->stdio->exec(array('interface_version')); + // support for querying file attributes of committed revisions + // was added for mtn 1.1 (interface version 13.1) + if (floatval($out) < 13.1) + return array(); + + $out = $this->stdio->exec(array('get_attributes', $path), array('r' => $rev)); + $stanzas = IDF_Scm_Monotone_BasicIO::parse($out); + $res = array(); + + foreach ($stanzas as $stanza) { + $line = $stanza[0]; + $res[$line['values'][0]] = $line['values'][1]; + } + + return $res; + } + + /** * @see IDF_Scm::getExtraProperties */ public function getExtraProperties($obj) diff --git a/src/IDF/templates/idf/source/mtn/file.html b/src/IDF/templates/idf/source/mtn/file.html index 2901c60..0c1bd19 100644 --- a/src/IDF/templates/idf/source/mtn/file.html +++ b/src/IDF/templates/idf/source/mtn/file.html @@ -5,12 +5,25 @@
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans} -{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} - | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+
| ||||||||||||||||
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans} + {blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} + |
+ {trans 'Message'} | {trans 'Size'} | -{if !$tree_in and !$tags_in} + +{if (!$tree_in and !$tags_in) or $props} {aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} -||||||||||||||
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans} -{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} - | ||||||||||||||||
+
| ||||||||||||||||
{blocktrans}Source at commit {$commit} created {$cobject.date|dateago}.{/blocktrans} + {blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans} + | ||||||||||||||||
diff --git a/src/IDF/templates/idf/source/svn/file.html b/src/IDF/templates/idf/source/svn/file.html index 5ed8114..27e6aca 100644 --- a/src/IDF/templates/idf/source/svn/file.html +++ b/src/IDF/templates/idf/source/svn/file.html @@ -6,13 +6,13 @@ |
| {trans 'Size'} | {if (!$tree_in and !$tags_in and $commit != 'HEAD') || $props} - {aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} + {aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)} {if $props}||||
---|---|---|---|---|---|
| {$file.file} | -{$file.date|dateago:"without"} | +{$file.date|dateago:"without"} | {$file.rev} | {$file.author|strip_tags|trim}{trans ':'} {issuetext $file.log, $request, true, false} | {if $file.type == 'blob'} diff --git a/test/IDF/Scm/MonotoneTest.php b/test/IDF/Scm/MonotoneTest.php index a278fba..c50c1b0 100644 --- a/test/IDF/Scm/MonotoneTest.php +++ b/test/IDF/Scm/MonotoneTest.php @@ -714,6 +714,31 @@ END; $this->assertEquals('', $commit->diff); } + public function testGetProperties() + { + $rev = "2345678901234567890123456789012345678901"; + + $instance = $this->createMock(); + $instance->getStdio()->setExpectedOutput(array('interface_version'), array(), '13.1'); + + $stdio =<<