[Fusionforge-general] about plugin scmhg
Franck Villaume
franck.villaume at trivialdev.com
Sun Jul 1 12:30:03 CEST 2012
Le 01/07/2012 02:56, Coiby Xu a écrit :
> A bit weird...
> Today it works again. I don't change anything...
I dont know what to say.
Any errors at fs level ?
>
> On Fri, Jun 29, 2012 at 11:53 PM, Coiby Xu <coiby.xu at gmail.com
> <mailto:coiby.xu at gmail.com>> wrote:
>
> Hi Franck,
>
> I don't know why this error occur again:
>
> *RepoError*: repository /var/lib/gforge/chroot/scmrepos/hg/demo not
> found
> args = ('repository /var/lib/gforge/chroot/scmrepos/hg/demo
> not found',)
> hint = None
>
> *1. hgweb.cgi*
>
> import cgitb; cgitb.enable()
>
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb, wsgicgi
> application = hgweb(config)
> wsgicgi.launch(application)
>
> *2. demo.cgi*
> import cgitb; cgitb.enable()
>
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb, wsgicgi
> application = hgweb("/var/lib/gforge/chroot/scmrepos/hg/demo","demo")
> wsgicgi.launch(application)
>
> On Tue, Jun 26, 2012 at 9:43 PM, Coiby Xu <coiby.xu at gmail.com
> <mailto:coiby.xu at gmail.com>> wrote:
>
> Got it!
>
> Thanks for explaining:)
>
>
> On Wed, Jun 27, 2012 at 5:35 PM, Franck Villaume
> <franck.villaume at trivialdev.com
> <mailto:franck.villaume at trivialdev.com>> wrote:
>
> Coiby Xu wrote:
>
> Another thing is why do you think "common point of entry
> for all hg
> repositories" is very bad? In fact, only public projects
> are listed.
>
>
> Here is the storyboard :
> - you browse project A
> - you select SCM iframe
> - you can move to another project B from SCM iframe without
> leaving the project A.
>
> Not really good user experience.
>
> Franck.
>
> On Tue, Jun 26, 2012 at 3:41 PM,
> franck.villaume at trivialdev.com
> <mailto:franck.villaume at trivialdev.com>
> <mailto:franck.villaume at __trivialdev.com
> <mailto:franck.villaume at trivialdev.com>>
> <franck.villaume at trivialdev.__com
> <mailto:franck.villaume at trivialdev.com>
> <mailto:franck.villaume at __trivialdev.com
> <mailto:franck.villaume at trivialdev.com>>> wrote:
>
> __
>
>
> Hi,
>
> are you sure your approach does not offer a common
> point of entry
> for all hg repositories as gitweb and scmgit do
> (which is really bad
> btw) ?
>
> Mercurial documentation explains you need at least
> 2 hgweb scripts
> to handle different levels of access public / private.
>
> I'll give a try as soon as possible.
>
> regards.
>
> Franck aka nerville
>
>
> Le 26 juin 2012 à 07:51, Coiby Xu <coiby.xu at gmail.com
> <mailto:coiby.xu at gmail.com>
> <mailto:coiby.xu at gmail.com
> <mailto:coiby.xu at gmail.com>>> a écrit :
>
>
> > Hi all,
> >
> > I've tested scmhg of trunk version. It's good.
> >
> > And I suggest to use for hg, so we don't need create
> {unix_name}.cgi for
> > each project:
> > a. for file *hgweb.config*:
> > [paths]
> > / = /var/lib/gforge/chroot/__scmrepos/hg/*
> >
> > b. for file* hgweb.cgi:*
> > #!/usr/bin/env python
> > #
> > # An example hgweb CGI script, edit as necessary
> > # See also
> http://mercurial.selenic.com/__wiki/PublishingRepositories
> <http://mercurial.selenic.com/wiki/PublishingRepositories>
> >
> > # Path to repo or hgweb config to serve (see 'hg
> help hgweb')
> > config = "hgweb.config"
> >
> > # Uncomment and adjust if Mercurial is not
> installed system-wide
> > # (consult "installed modules" path from 'hg
> debuginstall'):
> > #import sys; sys.path.insert(0, "/path/to/python/lib")
> >
> > # Uncomment to send python tracebacks to the
> browser if an error
> occurs:
> > import cgitb; cgitb.enable()
> >
> > from mercurial import demandimport;
> demandimport.enable()
> > from mercurial.hgweb import hgweb, wsgicgi, hgwebdir
> > application = hgwebdir(config)
> > wsgicgi.launch(application)
> >
> >
> > *The whole modifications are as follows and for
> the modified one
> see the
> > attachment:*
> >
> > Index: www/cgi-bin/hgweb.config
> >
> ==============================__==============================__=======
> > --- www/cgi-bin/hgweb.config (revision 0)
> > +++ www/cgi-bin/hgweb.config (revision 0)
> > @@ -0,0 +1,7 @@
> > +[web]
> > +style = gitweb
> > +allow_archive = gz zip
> > +
> > +[paths]
> > +/ = /var/lib/gforge/chroot/__scmrepos/hg/*
> > +
> > Index: www/cgi-bin/hgweb.cgi
> >
> ==============================__==============================__=======
> > --- www/cgi-bin/hgweb.cgi (revision 0)
> > +++ www/cgi-bin/hgweb.cgi (revision 0)
> > @@ -0,0 +1,19 @@
> > +#!/usr/bin/env python
> > +#
> > +# An example hgweb CGI script, edit as necessary
> > +# See also
> http://mercurial.selenic.com/__wiki/PublishingRepositories
> <http://mercurial.selenic.com/wiki/PublishingRepositories>
> > +
> > +# Path to repo or hgweb config to serve (see 'hg
> help hgweb')
> > +config = "hgweb.config"
> > +
> > +# Uncomment and adjust if Mercurial is not
> installed system-wide
> > +# (consult "installed modules" path from 'hg
> debuginstall'):
> > +#import sys; sys.path.insert(0,
> "/path/to/python/lib")
> > +
> > +# Uncomment to send python tracebacks to the
> browser if an error
> occurs:
> > +import cgitb; cgitb.enable()
> > +
> > +from mercurial import demandimport;
> demandimport.enable()
> > +from mercurial.hgweb import hgweb, wsgicgi, hgwebdir
> > +application = hgwebdir(config)
> > +wsgicgi.launch(application)
> >
> > Property changes on: www/cgi-bin/hgweb.cgi
> >
> _______________________________________________________________________
> > Added: svn:executable
> > + *
> >
> > Index: INSTALL
> >
> ==============================__==============================__=======
> > --- INSTALL (revision 0)
> > +++ INSTALL (revision 0)
> > @@ -0,0 +1,79 @@
> > +Mercurial Plugin
> > +================
> > +
> > +Just put the plugin files in the rigth place:
> > + /usr/share/gforge/src/plugins/__scmhg
> > +
> > +--> /usr/share/gforge/src/www/__plugins must
> contain a symlink to
> > /usr/share/src/gforge/plugins/__scmhg/www
> > +
> > +Make sure you have installed Mercurial correctly.
> The Plugin
> should work
> > with almost any Version of it.
> > +Now search the hgweb.cgi of your Mercurial
> install or download
> it from
> > http://mercurial.selenic.com/ .
> > +
> > +The file should contain some lines like:
> > + application = hgwebdir("hgweb.config",
> "repository name")
> > + wsgicgi.launch(application)
> > +This lines are needed to launch independend
> webpages for every
> mercurial
> > project.
> > +Put the hgweb.cgi into scmhg/www/cgi-bin and make
> sure that it
> is readable
> > for the user running fusionforges-cronjobs.
> > +
> > +Here is an example for hgweb.cgi:
> > +#!/usr/bin/env python
> > +#
> > +# An example hgweb CGI script, edit as necessary
> > +# See also
> http://mercurial.selenic.com/__wiki/PublishingRepositories
> <http://mercurial.selenic.com/wiki/PublishingRepositories>
> > +
> > +# Path to repo or hgweb config to serve (see 'hg
> help hgweb')
> > +config = "hgweb.config"
> > +
> > +# Uncomment and adjust if Mercurial is not
> installed system-wide
> > +# (consult "installed modules" path from 'hg
> debuginstall'):
> > +#import sys; sys.path.insert(0,
> "/path/to/python/lib")
> > +
> > +# Uncomment to send python tracebacks to the
> browser if an error
> occurs:
> > +import cgitb; cgitb.enable()
> > +
> > +from mercurial import demandimport;
> demandimport.enable()
> > +from mercurial.hgweb import hgweb, wsgicgi, hgwebdir
> > +application = hgwebdir(config)
> > +wsgicgi.launch(application)
> > +
> > +and hgweb.config file which is located in the
> same directory as
> hgweb.cgi
> > file:
> > +[web]
> > +style = gitweb
> > +
> > +[paths]
> > +/ = /var/lib/gforge/chroot/__scmrepos/hg/
> > +
> > +
> > +Now copy the fflog.tmpl file available in etc
> directory into
> your central
> > mercurial path for templates. It should be
> something like
> >
> '/usr/lib/python2.6/site-__packages/mercurial/templates/' .
> > +The path was correct, when you can use 'hg log
> --style
> fflog.tmpl' from
> > any hg repository. The template file is needed to
> gather
> statistics for the
> > sourcecode history.
> > +
> > +
> > +Your scmhg.ini (/etc/config.ini.d/) should
> contain the following
> entries:
> > + default_server, repos_path, use_ssh, use_ssl,
> use_dav,
> anonhg_login,
> > anonhg_password
> > +
> > +APACHE CONFIGURATION:
> > +
> > +Here is an example configuration for use with
> http and hgweb .
> > +
> > + #
> > + # Mercurial Repository
> > + #
> > + ScriptAliasMatch ^/hg/(.*)
> >
> /usr/share/gforge/src/www/__plugins/scmhg/cgi-bin/hgweb.__cgi/$1
> > + <Directory
> "/usr/share/gforge/src/www/__plugins/scmhg/cgi-bin">
> > + Options +ExecCGI FollowSymLinks
> Multiviews
> > + AddHandler cgi-script .cgi
> > + RewriteEngine On
> > + RewriteRule .* -
> > [E=REMOTE_USER:%{ENV:REDIRECT___REMOTE_USER}]
> > + AllowOverride None
> > + Order allow,deny
> > + Allow from all
> > + </Directory>
> > +
> > + <Location /hg>
> > + AuthType Basic
> > + AuthName "Mercurial Access"
> > + AuthUserFile
> /data_path/hgroot-authfile
> > + Require valid-user
> > + </Location>
> > +
> > +
> > Index: common/HgPlugin.class.php
> >
> ==============================__==============================__=======
> > --- common/HgPlugin.class.php (revision 149)
> > +++ common/HgPlugin.class.php (working copy)
> > @@ -65,7 +65,7 @@
> > $b .= 'This project\'s Mercurial repository can
> be checked out
> through
> > anonymous access with the following command.';
> > $b .= '</p>';
> > $b .= '<p>';
> > - $b .= '<tt>hg clone
> '.$protocol.'://'.forge_get___config('anonhg_login',
> > 'scmhg').'@' . $this->getBoxForProject($__project)
> . '/'. 'hg' .'/'.
> > $project->getUnixName() .'/'.'</tt><br />';
> > + $b .= '<tt>hg clone
> '.$protocol.'://'.forge_get___config('anonhg_login',
> > 'scmhg').'@' . $this->getBoxForProject($__project)
> . '/'. 'hg' .'/'.
> > $project->getUnixName() .'/'.'</tt><br />';
> > $b .= _('The password is
> ').forge_get_config('anonhg___password',
> > 'scmhg').'<br/>';
> >
> > } else {
> > @@ -183,7 +183,7 @@
> > }
> > if ($project->usesPlugin($this->__name)) {
> > if ($this->browserDisplayable($__project)) {
> > - print '<iframe
> >
>
> src="'.util_make_url('/__plugins/scmhg/cgi-bin/'.$__project->getUnixName().'.cgi?__p='.$project->getUnixName()).'__"
>
> > frameborder="0" width=100% height=700></iframe>';
> > + print '<iframe
> >
>
> src="'.util_make_url('/__plugins/scmhg/cgi-bin/'.'__hgweb.cgi/'.$project->__getUnixName()).'"
>
> > frameborder="0" width=100% height=700></iframe>';
> > }
> > }
> > }
> > @@ -207,36 +207,14 @@
> > }
> >
> > system("mkdir -p $repo");
> > - /** per project configuration for http **/
> > - if (forge_get_config('use_dav', 'scmhg')) {
> > - //get template hgweb.cgi
> > - $hgweb =
> >
>
> forge_get_config('source_path'__).'/plugins/scmhg/www/cgi-bin/__hgweb.cgi';
> > - $project_hgweb =
> >
>
> forge_get_config('source_path'__).'/www/plugins/scmhg/cgi-bin/__'.$project->getUnixName().'.__cgi';
>
> > - if (!is_file($project_hgweb)) {
> > - $lines = file($hgweb);
> > - $repo_config = "";
> > - foreach ($lines as $line) {
> > - if (preg_match("/\Aapplication = hgweb/",$line)) {
> > - //link per project hgweb.cgi to the project
> repository
> > - $repo_config .= "application =
> >
> hgweb(\"".$repo."\",\"".$__project->getUnixName()."\")\n"__;
> > - } else {
> > - $repo_config .= $line;
> > - }
> > - }
> > - $f = fopen($project_hgweb, 'w');
> > - fwrite($f, $repo_config);
> > - fclose($f);
> > - system("chown $unix_user:$unix_group
> $project_hgweb");
> > - system("chmod u+x $project_hgweb");
> > - }
> > - }
> > +
> > if (!is_dir("$repo/.hg")) {
> > system("hg init $repo");
> > $f = fopen("$repo/.hg/hgrc",'w');
> > $conf = "[web]\n";
> > $conf .= "baseurl = /hg";
> > $conf .= "\ndescription = ".$project->getUnixName();
> > - $conf .= "\nstyle = paper";
> > + $conf .= "\nstyle = gitweb";
> > $conf .= "\nallow_push = *"; //every user ( see
> apache
> configuration) is
> > allowed to push
> > $conf .= "\nallow_read = *"; // every user is
> allowed to clone
> and pull
> > fwrite($f, $conf);
> > @@ -521,4 +499,4 @@
> > // c-file-style: "bsd"
> > // End:
> >
> > -?>
> > \ No newline at end of file
> > +?>
> >
> > --
> > *Best regards,*
> > *Coiby*
> <https://plus.google.com/__112148485639399836230
> <https://plus.google.com/112148485639399836230>>
>
> TrivialDev Founder
> http://trivialdev.com
>
>
>
>
> --
> /Best regards,/
> /Coiby/ <https://plus.google.com/__112148485639399836230
> <https://plus.google.com/112148485639399836230>>
>
>
>
>
> --
> Franck Villaume
> TrivialDev Founder
> http://trivialdev.com
>
>
>
>
>
> --
> /Best regards,/
> /Coiby/ <https://plus.google.com/112148485639399836230>
>
>
>
>
>
> --
> /Best regards,/
> /Coiby/ <https://plus.google.com/112148485639399836230>
>
>
>
>
>
> --
> /Best regards,/
> /Coiby/ <https://plus.google.com/112148485639399836230>
>
>
--
TrivialDev Founder
http://trivialdev.com
More information about the Fusionforge-general
mailing list