This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, 6.1 has been updated
       via  f470a2022b26b55d353f7f4c14676756d2dc29bc (commit)
      from  4808b05036868217bdf06878d63254d8b273e8c0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=f470a2022b26b55d353f7f4c14676756d2dc29bc

commit f470a2022b26b55d353f7f4c14676756d2dc29bc
Author: Franck Villaume <franck.villa...@trivialdev.com>
Date:   Thu Feb 8 15:36:39 2018 +0000

    scmhg: support multirepo. make the main repo works. prepare multirepo 
support in hgweb config

diff --git a/src/plugins/scmhg/common/HgPlugin.class.php 
b/src/plugins/scmhg/common/HgPlugin.class.php
index f6dcf88..9b6f234 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -325,9 +325,8 @@ Offer DAV or SSH access.");
                        $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(\"".$root."\",\"".$project_name."\")\n";
+                               if (preg_match("/\Aconfig = /",$line)) {
+                                       $repo_config .= 'config = 
"'.$root.'/config"'."\n";
                                } else {
                                        $repo_config .= $line;
                                }
@@ -340,25 +339,32 @@ Offer DAV or SSH access.");
                        system("chown $apache_user:$apache_group 
$project_hgweb");
                        system("chmod 755 $project_hgweb");
                }
-               if (!is_dir("$root/.hg")) {
-                       system("hg init $root");
-                       $f = fopen("$root/.hg/hgrc",'w');
+               if (!is_file("$root/config")) {
+                       $f = fopen("$root/config", 'w');
+                       $conf = "[paths]\n";
+                       $conf .= "/ = ".$root.'/*'."\n";
+                       fwrite($f, $conf);
+                       fclose($f);
+               }
+               if (!is_dir("$root/$project_name/.hg")) {
+                       system("hg init $root/$project_name");
+                       $f = fopen("$root/$project_name/.hg/hgrc",'w');
                        $conf = "[web]\n";
-                       $conf .= "baseurl = /hg";
-                       $conf .= "\ndescription = ".$project_name;
-                       $conf .= "\nstyle = paper";
-                       $conf .= "\nallow_push = *"; // every user (see Apache 
configuration) is allowed to push
-                       $conf .= "\nallow_read = *"; // every user is allowed 
to clone and pull
+                       $conf .= "baseurl = /hg/".$project_name."\n";
+                       $conf .= "description = ".$project_name."\n";
+                       $conf .= "style = paper\n";
+                       $conf .= "allow_push = *\n"; // every user (see Apache 
configuration) is allowed to push
+                       $conf .= "allow_read = *\n"; // every user is allowed 
to clone and pull
                        if (!forge_get_config('use_ssl', 'scmhg')) {
-                               $conf .= "\npush_ssl = 0";
+                               $conf .= "push_ssl = 0\n";
                        }
                        fwrite($f, $conf);
                        fclose($f);
                        //system("chmod 770 $root");
                        //system("find $root -type d | xargs chmod g+s");
-                       system("chgrp -R $unix_group_rw $root");
-                       system("chmod -R g=rwX,o=rX $root");
-                       system("chmod 660 $root/.hg/hgrc");
+                       system("chgrp -R $unix_group_rw $root/$project_name");
+                       system("chmod -R g=rwX,o=rX $root/$project_name");
+                       system("chmod 660 $root/$project_name/.hg/hgrc");
                }
        }
 
@@ -366,7 +372,6 @@ Offer DAV or SSH access.");
                $groups = $this->getGroups();
                $unix_group = forge_get_config('apache_group');
                $unix_user = forge_get_config('apache_user');
-               $password_data = '';
                $hgusers = array();
                foreach ($groups as $project) {
                        if (!$project->isActive()) continue;
@@ -375,7 +380,7 @@ Offer DAV or SSH access.");
 
                        $push = "";
                        $read = ""; /*pull,clone*/
-                       $path = forge_get_config('repos_path', 
'scmhg').'/'.$project->getUnixName().'/.hg';
+                       $path = forge_get_config('repos_path', 
'scmhg').'/'.$project->getUnixName().'/'.$project->getUnixName.'/.hg';
                        $prevp = false;
                        $prevr = false;
                        $users = $project->getMembers();
@@ -435,7 +440,7 @@ Offer DAV or SSH access.");
                                }
                        } else {
                                $hgrc = "[web]\n";
-                               $hgrc .= "baseurl = /hg";
+                               $hgrc .= "baseurl = 
/hg/".$project->getUnixName();
                                $hgrc .= "\ndescription = 
".$project->getUnixName();
                                $hgrc .= "\nstyle = paper";
                                $hgrc .= "\nallow_read = ".$read;

-----------------------------------------------------------------------

Summary of changes:
 src/plugins/scmhg/common/HgPlugin.class.php | 41 ++++++++++++++++-------------
 1 file changed, 23 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
Fusionforge-commits@lists.fusionforge.org
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to