From 0031f3ec68344e960f168b23fa283b76dbf6c67d Mon Sep 17 00:00:00 2001 From: Roland Mas Date: Tue, 23 Feb 2010 11:02:11 +0000 Subject: [PATCH] Display actual loginname for the SCM read/write instructions when it's known --- .../plugins/scmbzr/common/BzrPlugin.class.php | 12 ++++++-- .../scmcpold/common/CpoldPlugin.class.php | 11 ++++++-- .../plugins/scmcvs/common/CVSPlugin.class.php | 15 ++++++++-- .../plugins/scmgit/common/GitPlugin.class.php | 9 +++++- .../plugins/scmhg/common/HgPlugin.class.php | 11 ++++++-- .../plugins/scmsvn/common/SVNPlugin.class.php | 28 +++++++++++++------ 6 files changed, 67 insertions(+), 19 deletions(-) diff --git a/gforge/plugins/scmbzr/common/BzrPlugin.class.php b/gforge/plugins/scmbzr/common/BzrPlugin.class.php index fe747b0138..e6b05b61d2 100644 --- a/gforge/plugins/scmbzr/common/BzrPlugin.class.php +++ b/gforge/plugins/scmbzr/common/BzrPlugin.class.php @@ -90,9 +90,15 @@ class BzrPlugin extends SCMPlugin { function getInstructionsForRW ($project) { $b = '' ; - $b .= _('

Developer Bazaar Access via SSH

Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); - $b .= '

bzr checkout bzr+ssh://'._('developername').'@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'

' ; - + if (session_loggedin()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + $b .= _('

Developer Bazaar Access via SSH

Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Enter your site password when prompted.

'); + $b .= '

bzr checkout bzr+ssh://'.$d.'@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'

' ; + } else { + $b .= _('

Developer Bazaar Access via SSH

Only project developers can access the Bazaar branches via this method. SSH must be installed on your client machine. Substitute developername with the proper value. Enter your site password when prompted.

'); + $b .= '

bzr checkout bzr+ssh://'._('developername').'@' . $project->getSCMBox() . $this->bzr_root .'/'. $project->getUnixName().'/'._('branchname').'

' ; + } return $b ; } diff --git a/gforge/plugins/scmcpold/common/CpoldPlugin.class.php b/gforge/plugins/scmcpold/common/CpoldPlugin.class.php index 340a7832d2..5034242f21 100644 --- a/gforge/plugins/scmcpold/common/CpoldPlugin.class.php +++ b/gforge/plugins/scmcpold/common/CpoldPlugin.class.php @@ -70,8 +70,15 @@ class CpoldPlugin extends SCMPlugin { } function getInstructionsForRW ($project) { - $b = _('

Developer CPOLD Access via SSH

Only project developers can access the CPOLD tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); - $b .= '

scp -r '._('developername').'@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .

' ; + if (session_loggedin()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + $b = _('

Developer CPOLD Access via SSH

Only project developers can access the CPOLD tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.

'); + $b .= '

scp -r '.$d.'@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .

' ; + } else { + $b = _('

Developer CPOLD Access via SSH

Only project developers can access the CPOLD tree via this method. SSH must be installed on your client machine. Substitute developername with the proper value. Enter your site password when prompted.

'); + $b .= '

scp -r '._('developername').'@' . $project->getSCMBox() . ':'. $this->cpold_root .'/'. $project->getUnixName().'/ .

' ; + } return $b ; } diff --git a/gforge/plugins/scmcvs/common/CVSPlugin.class.php b/gforge/plugins/scmcvs/common/CVSPlugin.class.php index ed4bfe13ee..ae8f47d9ea 100644 --- a/gforge/plugins/scmcvs/common/CVSPlugin.class.php +++ b/gforge/plugins/scmcvs/common/CVSPlugin.class.php @@ -89,12 +89,21 @@ class CVSPlugin extends SCMPlugin { function getInstructionsForRW ($project) { $cvsrootend = $project->getSCMBox().':'.$this->cvs_root.'/'.$project->getUnixName(); - $b = _('

Developer CVS Access via SSH

Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute modulename and developername with the proper values. Enter your site password when prompted.

'); - $b .= '

+ if (session_loggedin()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + $b = _('

Developer CVS Access via SSH

Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute modulename with the proper value. Enter your site password when prompted.

'); + $b .= '

+ export CVS_RSH=ssh
+ cvs -d :ext:'.$d.'@'.$cvsrootend.' checkout '._('modulename').' +

'; + } else { + $b = _('

Developer CVS Access via SSH

Only project developers can access the CVS tree via this method. SSH must be installed on your client machine. Substitute modulename and developername with the proper values. Enter your site password when prompted.

'); + $b .= '

export CVS_RSH=ssh
cvs -d :ext:'._('developername').'@'.$cvsrootend.' checkout '._('modulename').'

'; - + } return $b ; } diff --git a/gforge/plugins/scmgit/common/GitPlugin.class.php b/gforge/plugins/scmgit/common/GitPlugin.class.php index cc3fac0568..077a02c481 100644 --- a/gforge/plugins/scmgit/common/GitPlugin.class.php +++ b/gforge/plugins/scmgit/common/GitPlugin.class.php @@ -83,8 +83,15 @@ class GitPlugin extends SCMPlugin { } function getInstructionsForRW ($project) { - $b = _('

Developer GIT Access via SSH

Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); + if (session_logged_in()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + $b = _('

Developer GIT Access via SSH

Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.

'); + $b .= '

git clone git+ssh://'.$d.'@' . $project->getSCMBox() . $this->git_root .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git

' ; + } else { + $b = _('

Developer GIT Access via SSH

Only project developers can access the GIT tree via this method. SSH must be installed on your client machine. Substitute developername with the proper value. Enter your site password when prompted.

'); $b .= '

git clone git+ssh://'._('developername').'@' . $project->getSCMBox() . $this->git_root .'/'. $project->getUnixName() .'/'. $project->getUnixName() .'.git

' ; + } return $b ; } diff --git a/gforge/plugins/scmhg/common/HgPlugin.class.php b/gforge/plugins/scmhg/common/HgPlugin.class.php index f118fc70e0..3591b213c6 100644 --- a/gforge/plugins/scmhg/common/HgPlugin.class.php +++ b/gforge/plugins/scmhg/common/HgPlugin.class.php @@ -58,8 +58,15 @@ class HgPlugin extends SCMPlugin { } function getInstructionsForRW ($project) { - $b = _('

Developer Mercurial Access via SSH

Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); - $b .= '

hg clone hg+ssh://'._('developername').'@' . $project->getSCMBox() . ':'. $this->hg_root .'/'. $project->getUnixName().'/ .

' ; + if (session_logged_in()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + $b = _('

Developer Mercurial Access via SSH

Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.

'); + $b .= '

hg clone hg+ssh://'.$d.'@' . $project->getSCMBox() . ':'. $this->hg_root .'/'. $project->getUnixName().'/ .

' ; + } else { + $b = _('

Developer Mercurial Access via SSH

Only project developers can access the Mercurial tree via this method. SSH must be installed on your client machine. Substitute developername with the proper value. Enter your site password when prompted.

'); + $b .= '

hg clone hg+ssh://'.$d.'@' . $project->getSCMBox() . ':'. $this->hg_root .'/'. $project->getUnixName().'/ .

' ; + } return $b ; } diff --git a/gforge/plugins/scmsvn/common/SVNPlugin.class.php b/gforge/plugins/scmsvn/common/SVNPlugin.class.php index 6677c05370..d6f457c2c9 100644 --- a/gforge/plugins/scmsvn/common/SVNPlugin.class.php +++ b/gforge/plugins/scmsvn/common/SVNPlugin.class.php @@ -93,15 +93,27 @@ class SVNPlugin extends SCMPlugin { function getInstructionsForRW ($project) { $b = '' ; - if ($this->use_ssh) { - $b .= _('

Developer Subversion Access via SSH

Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); - $b .= '

svn checkout svn+ssh://'._('developername').'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'

' ; - } - if ($this->use_dav) { - $b .= _('

Developer Subversion Access via DAV

Only project developers can access the SVN tree via this method. Substitute developername with the proper values. Enter your site password when prompted.

'); - $b .= '

svn checkout --username '._('developername').' http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'

' ; + if (session_loggedin()) { + $u =& user_get_object(user_getid()) ; + $d = $u->getUnixName() ; + if ($this->use_ssh) { + $b .= _('

Developer Subversion Access via SSH

Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Enter your site password when prompted.

'); + $b .= '

svn checkout svn+ssh://'.$d.'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'

' ; + } + if ($this->use_dav) { + $b .= _('

Developer Subversion Access via DAV

Only project developers can access the SVN tree via this method. Enter your site password when prompted.

'); + $b .= '

svn checkout --username '.$d.' http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'

' ; + } + } else { + if ($this->use_ssh) { + $b .= _('

Developer Subversion Access via SSH

Only project developers can access the SVN tree via this method. SSH must be installed on your client machine. Substitute developername with the proper values. Enter your site password when prompted.

'); + $b .= '

svn checkout svn+ssh://'._('developername').'@' . $project->getSCMBox() . $this->svn_root .'/'. $project->getUnixName().'

' ; + } + if ($this->use_dav) { + $b .= _('

Developer Subversion Access via DAV

Only project developers can access the SVN tree via this method. Substitute developername with the proper values. Enter your site password when prompted.

'); + $b .= '

svn checkout --username '._('developername').' http'.(($this->use_ssl) ? 's' : '').'://'. $project->getSCMBox() . $this->svn_root .'/'.$project->getUnixName().'

' ; + } } - return $b ; } -- 2.30.2