Skip to content

Commit

Permalink
interface VersioncontrolItemGetFileAnnotation
Browse files Browse the repository at this point in the history
it allow us to avoid the vc callback get_file_annotation
  • Loading branch information
marvil07 committed Jul 28, 2009
1 parent 6c0504b commit b38a075
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 4 additions & 12 deletions includes/VersioncontrolItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,13 +751,7 @@ public function exportDirectory($destination_dirpath) {
* operation, so expect this function to take a bit more time as well.
*
* This function is optional for VCS backends to implement, be sure to check
* with versioncontrol_backend_implements($repository['vcs'], 'get_file_annotation')
* if the particular backend actually implements it.
*
* @param $repository
* The repository that the file item is located in.
* @param $file_item
* The file item whose annotation should be retrieved.
* the return to NULL.
*
* @return
* A structured array that consists of one element per line, with
Expand All @@ -774,13 +768,11 @@ public function exportDirectory($destination_dirpath) {
* A real-life example of such a result array can be found
* in the FakeVCS example module.
*/
public function getFileAnnotation($repository, $file_item) {
if (!versioncontrol_is_file_item($file_item)) {
public function getFileAnnotation() {
if (!$this->isFile() || $this instanceof VersioncontrolItemGetFileAnnotation) {
return NULL;
}
return _versioncontrol_call_backend(
$repository['vcs'], 'get_file_annotation', array($repository, $file_item)
);
return $this->_getFileAnnotation();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions includes/classes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,7 @@ interface VersioncontrolItemExportFile {
interface VersioncontrolItemExportDirectory {
function _exportDirectory($destination_dirpath);
}

interface VersioncontrolItemGetFileAnnotation {
function _getFileAnnotation();
}

0 comments on commit b38a075

Please sign in to comment.