* idf.php-dist: improve the document of the various mtn-related configure options; introduce an option to configure the protocole - separate from the url option, which we now name mtn_remote_host

* IDF_Project: optionally give getSourceAccessUrl() a commit argument, so a particular VCS module can determine a subset of revisions to pull for the specific revision which is browsed
* IDF_Scm_*: add the argument null'd for all VCS; implement a branch lookup for monotone
* tree.html: display the correct branch to clone under each revision tree
This commit is contained in:
Thomas Keller
2010-05-02 00:56:04 +02:00
parent 3b53ceedcd
commit 59ad0f5b11
7 changed files with 176 additions and 107 deletions

View File

@@ -381,15 +381,16 @@ class IDF_Project extends Pluf_Model
* This will return the right url based on the user.
*
* @param Pluf_User The user (null)
* @param string A specific commit to access
*/
public function getSourceAccessUrl($user=null)
public function getSourceAccessUrl($user=null, $commit=null)
{
$right = $this->getConf()->getVal('source_access_rights', 'all');
if (($user == null or $user->isAnonymous())
and $right == 'all' and !$this->private) {
return $this->getRemoteAccessUrl();
return $this->getRemoteAccessUrl($commit);
}
return $this->getWriteRemoteAccessUrl($user);
return $this->getWriteRemoteAccessUrl($user, $commit);
}
@@ -397,15 +398,17 @@ class IDF_Project extends Pluf_Model
* Get the remote access url to the repository.
*
* This will always return the anonymous access url.
*
* @param string A specific commit to access
*/
public function getRemoteAccessUrl()
public function getRemoteAccessUrl($commit=null)
{
$conf = $this->getConf();
$scm = $conf->getVal('scm', 'git');
$scms = Pluf::f('allowed_scm');
Pluf::loadClass($scms[$scm]);
return call_user_func(array($scms[$scm], 'getAnonymousAccessUrl'),
$this);
$this, $commit);
}
/**
@@ -414,14 +417,16 @@ class IDF_Project extends Pluf_Model
* Some SCM have a remote access URL to write which is not the
* same as the one to read. For example, you do a checkout with
* git-daemon and push with SSH.
*
* @param string A specific commit to access
*/
public function getWriteRemoteAccessUrl($user)
public function getWriteRemoteAccessUrl($user,$commit=null)
{
$conf = $this->getConf();
$scm = $conf->getVal('scm', 'git');
$scms = Pluf::f('allowed_scm');
return call_user_func(array($scms[$scm], 'getAuthAccessUrl'),
$this, $user);
$this, $user, $commit);
}
/**