[vhffs-dev] [2050] Reworked Mercurial robots the same way we did for Cvs,Bazaar, Svn and Git

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 2050
Author:   gradator
Date:     2012-02-25 02:15:53 +0100 (Sat, 25 Feb 2012)
Log Message:
-----------
Reworked Mercurial robots the same way we did for Cvs,Bazaar,Svn and Git

Modified Paths:
--------------
    trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
    trunk/vhffs-robots/Makefile.am

Added Paths:
-----------
    trunk/vhffs-robots/src/mercurial.pl

Removed Paths:
-------------
    trunk/vhffs-robots/src/mercurial_create.pl
    trunk/vhffs-robots/src/mercurial_delete.pl
    trunk/vhffs-robots/src/mercurial_public.pl

Modified: trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-02-25 00:50:48 UTC (rev 2049)
+++ trunk/vhffs-api/src/Vhffs/Robots/Mercurial.pm	2012-02-25 01:15:53 UTC (rev 2050)
@@ -35,32 +35,34 @@
 use File::Path;
 use File::Basename;
 
-package Vhffs::Robots::Mercurial;
-
-use Vhffs::Services::Mercurial;
 use Vhffs::Constants;
 use Vhffs::Functions;
+use Vhffs::Robots;
+use Vhffs::Services::Mercurial;
 
-sub create_repo
-{
+package Vhffs::Robots::Mercurial;
+
+sub create {
 	my $mercurial = shift;
-	return -1 unless defined $mercurial;
-	return -1 if $mercurial->get_status != Vhffs::Constants::WAITING_FOR_CREATION;
+	return undef unless defined $mercurial and $mercurial->get_status == Vhffs::Constants::WAITING_FOR_CREATION;
 
+	my $vhffs = $mercurial->get_main;
 	my $dir = $mercurial->get_dir;
 
 	if( -e $dir ) {
 		$mercurial->set_status( Vhffs::Constants::CREATION_ERROR );
 		$mercurial->commit();
-		$mercurial->add_history('Error, directory of this mercurial repository already exists! Administrators must fix the problem.');
-		return -1;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mercurial repository '.$mercurial->get_reponame.' to the filesystem' );
+		return undef;
 	}
 
-	# TODO: check make_path
-	File::Path::make_path( $dir );
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $mercurial->get_owner_uid , $mercurial->get_owner_gid );
-	$mercurial->add_history('Ok, robots find the empty directory and will create mercurial repository');
+	File::Path::make_path( $dir, { error => \my $errors });
+	if(@$errors) {
+		$mercurial->set_status( Vhffs::Constants::CREATION_ERROR );
+		$mercurial->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mercurial repository '.$mercurial->get_reponame.' to the filesystem' );
+		return undef;
+	}
 
 	my $oldcwd = Cwd::getcwd();
 	if( chdir($dir) ) {
@@ -79,92 +81,123 @@
 
 	unless( -d $dir.'/.hg' ) {
 		$mercurial->set_status( Vhffs::Constants::CREATION_ERROR );
-		$mercurial->commit();
-		$mercurial->add_history('Error, nothing was created after calling the mercurial binary, something is wrong.');
-		return -1;
+		$mercurial->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while creating mercurial repository '.$mercurial->get_reponame.' to the filesystem' );
+		return undef;
 	}
 
-	Vhffs::Robots::chmod_recur( $dir , 0664 , 02775 );
-	Vhffs::Robots::chown_recur( $dir , $mercurial->get_owner_uid , $mercurial->get_owner_gid );
+	Vhffs::Robots::chmod_recur( $dir, 0664, 02775 );
+	Vhffs::Robots::chown_recur( $dir, $mercurial->get_owner_uid, $mercurial->get_owner_gid );
 
-	change_conf( $mercurial );
+	Vhffs::Robots::vhffs_log( $vhffs, 'Created mercurial repository '.$mercurial->get_reponame );
+	return modify( $mercurial );
+}
 
-	$mercurial->add_history('The Robots created the mercurial repository');
-	$mercurial->set_status( Vhffs::Constants::ACTIVATED );
-	$mercurial->commit;
+sub delete {
+	my $mercurial = shift;
+	return undef unless defined $mercurial and $mercurial->get_status == Vhffs::Constants::WAITING_FOR_DELETION;
 
-	return 0;
+	my $vhffs = $mercurial->get_main;
+	my $dir = $mercurial->get_dir;
+
+	Vhffs::Robots::archive_targz( $mercurial, $dir );
+
+	File::Path::remove_tree( $dir, { error => \my $errors });
+	my $groupdir = File::Basename::dirname($dir);
+	rmdir($groupdir);
+
+	if(@$errors) {
+		$mercurial->set_status( Vhffs::Constants::DELETION_ERROR );
+		$mercurial->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while removing mercurial repository '.$mercurial->get_reponame.' from the filesystem' );
+		return undef;
+	}
+
+	if( $mercurial->delete ) {
+		Vhffs::Robots::vhffs_log( $vhffs, 'Deleted mercurial repository '.$mercurial->get_reponame );
+	} else {
+		$mercurial->set_status( Vhffs::Constants::DELETION_ERROR );
+		$mercurial->commit;
+		Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while deleting mercurial repository '.$mercurial->get_reponame.' object' );
+		return undef;
+	}
+
+	return 1;
 }
 
-sub change_conf {
+sub modify {
 	my $mercurial = shift;
-	return -1 unless defined $mercurial;
+	return undef unless defined $mercurial and ( $mercurial->get_status == Vhffs::Constants::WAITING_FOR_MODIFICATION or $mercurial->get_status == Vhffs::Constants::WAITING_FOR_CREATION );
 
+	my $vhffs = $mercurial->get_main;
 	my $dir = $mercurial->get_dir;
+
+	if( $mercurial->is_public ) {
+		chmod 02775, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Mercurial repository '.$mercurial->get_reponame.' is now public' );
+		$mercurial->add_history( 'Is now public');
+	}
+	else {
+		chmod 02770, $dir;
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Mercurial repository '.$mercurial->get_reponame.' is now private' );
+		$mercurial->add_history( 'Is now private');
+	}
+
 	my $mail_from = $mercurial->get_main->get_config->get_service('mercurial')->{notify_from};
 	my $mladdress = $mercurial->{ml_name};
 
-	open( my $rcfileout , "> ", $dir . '/.hg/hgrc' );
-
+	my $rcfileoutpath = $dir.'/.hg/hgrc';
+	open( my $rcfileout, '>', $rcfileoutpath ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying mercurial repository, cannot open '.$rcfileoutpath );
 	unless (defined $rcfileout) {
-		$mercurial->add_history('An error occured while opening the repository configuration file.');
-		return -1;
+		$mercurial->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+		$mercurial->commit;
+		return undef;
 	}
 
 	my $description = $mercurial->get_description;
 	# multi line values should be indented
 	$description =~ s/(\r)?\n/\n  /g;
 
-	print $rcfileout "[web]\n";
-	print $rcfileout "description =\n  " . $description . "\n";
+	print $rcfileout '[web]'."\n";
+	print $rcfileout 'description ='."\n".'  '.$description."\n";
 	require Vhffs::Services::MailGroup;
-	my $mg = new Vhffs::Services::MailGroup( $mercurial->get_main , $mercurial->get_group );
-	if( defined $mg ) {
-		print $rcfileout "contact = " . $mercurial->get_group->get_groupname . '@' . $mg->{config}->{domain} . "\n";
-	}
+	my $mg = new Vhffs::Services::MailGroup( $vhffs, $mercurial->get_group );
+	print $rcfileout 'contact = '.$mercurial->get_group->get_groupname.'@'.$mg->{config}->{domain}."\n" if defined $mg;
 	print $rcfileout "\n";
 
 	if( $mladdress !~ /^\s*$/ ) {
+		my $rcfileinpath = '%VHFFS_BOTS_DIR%/misc/mercurial_notify.rc';
+
 		# Create the rc file
-		open( my $rcfilein , "< ", "%VHFFS_BOTS_DIR%/misc/mercurial_notify.rc" );
-
+		open( my $rcfilein, '<', $rcfileinpath ) or Vhffs::Robots::vhffs_log( $vhffs, 'An error occured while modifying mercurial repository, cannot open '.$rcfileinpath );
 		unless (defined $rcfilein) {
-			$mercurial->add_history("Can't read the configuration template file. This is wrong, very wrong.");
-			return -1;
+			$mercurial->set_status( Vhffs::Constants::MODIFICATION_ERROR );
+			$mercurial->commit;
+			return undef;
 		}
 
-		while( my $line = <$rcfilein> )
-		{
-			$line =~ s/MY_MLADDRESS/$mladdress/g;
-			$line =~ s/MY_FROMADDRESS/$mail_from/g;
+		while( <$rcfilein> ) {
+			$_ =~ s/MY_MLADDRESS/$mladdress/g;
+			$_ =~ s/MY_FROMADDRESS/$mail_from/g;
 
-			print $rcfileout $line;
+			print $rcfileout $_;
 		}
 
 		close( $rcfilein );
+
+		Vhffs::Robots::vhffs_log( $vhffs, 'Mercurial repository '.$mercurial->get_reponame.' commit mail set to '.$mladdress );
+		$mercurial->add_history( 'Commit mail set to '.$mladdress );
 	}
 
 	close( $rcfileout );
+	chmod 0644, $rcfileoutpath;
 
-	return 0;
-}
+	$mercurial->set_status( Vhffs::Constants::ACTIVATED );
+	$mercurial->commit;
 
-sub delete_repo
-{
-	my $mercurial = shift;
-	return -1 unless defined $mercurial;
-
-	# Remove Mercurial dir and group dir if empty
-	my $dir = $mercurial->get_dir;
-	Vhffs::Robots::archive_targz( $mercurial, $dir );
-
-	# TODO:check remove_tree
-	File::Path::remove_tree($dir) if(-d $dir);
-	my $groupdir = File::Basename::dirname($dir);
-	rmdir($groupdir);
-
-	return 0;
+	return 1;
 }
 
-
 1;

Modified: trunk/vhffs-robots/Makefile.am
===================================================================
--- trunk/vhffs-robots/Makefile.am	2012-02-25 00:50:48 UTC (rev 2049)
+++ trunk/vhffs-robots/Makefile.am	2012-02-25 01:15:53 UTC (rev 2050)
@@ -21,7 +21,6 @@
 	misc/git_post-receive
 
 dist_bots_SCRIPTS = \
-	src/cvs.pl \
 	src/dns_create.pl \
 	src/dns_delete.pl \
 	src/group_create.pl \
@@ -48,11 +47,10 @@
 	src/repository_delete.pl \
 	src/repository_quota.pl \
 	src/repository_stats.pl \
+	src/cvs.pl \
 	src/svn.pl \
 	src/git.pl \
-	src/mercurial_create.pl \
-	src/mercurial_delete.pl \
-	src/mercurial_public.pl \
+	src/mercurial.pl \
 	src/bazaar.pl \
 	src/user_create.pl \
 	src/user_delete.pl \

Copied: trunk/vhffs-robots/src/mercurial.pl (from rev 2043, trunk/vhffs-robots/src/mercurial_create.pl)
===================================================================
--- trunk/vhffs-robots/src/mercurial.pl	                        (rev 0)
+++ trunk/vhffs-robots/src/mercurial.pl	2012-02-25 01:15:53 UTC (rev 2050)
@@ -0,0 +1,59 @@
+#!%PERL%
+# Copyright (c) vhffs project and its contributors
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright 
+#   notice, this list of conditions and the following disclaimer.
+#2. Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in 
+#   the documentation and/or other materials provided with the 
+#   distribution.
+#3. Neither the name of vhffs nor the names of its contributors 
+#   may be used to endorse or promote products derived from this 
+#   software without specific prior written permission.
+#
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
+#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
+#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+# POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+use utf8;
+
+use lib '%VHFFS_LIB_DIR%';
+use Vhffs::Robots::Mercurial;
+
+my $vhffs = init Vhffs::Main;
+exit 1 unless defined $vhffs;
+
+Vhffs::Robots::lock( $vhffs, 'mercurial' );
+
+my $repos = Vhffs::Services::Mercurial::getall( $vhffs, Vhffs::Constants::WAITING_FOR_CREATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Mercurial::create( $_ );
+}
+
+$repos = Vhffs::Services::Mercurial::getall( $vhffs, Vhffs::Constants::WAITING_FOR_DELETION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Mercurial::delete( $_ );
+}
+
+$repos = Vhffs::Services::Mercurial::getall( $vhffs, Vhffs::Constants::WAITING_FOR_MODIFICATION );
+foreach ( @{$repos} ) {
+	Vhffs::Robots::Mercurial::modify( $_ );
+}
+
+Vhffs::Robots::unlock( $vhffs, 'mercurial' );
+exit 0;

Deleted: trunk/vhffs-robots/src/mercurial_create.pl
===================================================================
--- trunk/vhffs-robots/src/mercurial_create.pl	2012-02-25 00:50:48 UTC (rev 2049)
+++ trunk/vhffs-robots/src/mercurial_create.pl	2012-02-25 01:15:53 UTC (rev 2050)
@@ -1,59 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Mercurial;
-use Vhffs::Services::Mercurial;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'mercurial' );
-
-my $repos = Vhffs::Services::Mercurial::getall( $vhffs , Vhffs::Constants::WAITING_FOR_CREATION);
-foreach my $mercurial ( @{$repos} )
-{
-	if( Vhffs::Robots::Mercurial::create_repo( $mercurial ) != 0 ) {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot create Mercurial %s' , $mercurial->get_reponame ));
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Created Mercurial %s' , $mercurial->get_reponame ));
-	}
-}
-
-
-Vhffs::Robots::unlock( $vhffs , 'mercurial' );
-exit 0;

Deleted: trunk/vhffs-robots/src/mercurial_delete.pl
===================================================================
--- trunk/vhffs-robots/src/mercurial_delete.pl	2012-02-25 00:50:48 UTC (rev 2049)
+++ trunk/vhffs-robots/src/mercurial_delete.pl	2012-02-25 01:15:53 UTC (rev 2050)
@@ -1,64 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Mercurial;
-use Vhffs::Services::Mercurial;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'mercurial' );
-
-my $repos = Vhffs::Services::Mercurial::getall( $vhffs , Vhffs::Constants::WAITING_FOR_DELETION );
-foreach my $mercurial ( @{$repos} )
-{
-	if( Vhffs::Robots::Mercurial::delete_repo( $mercurial ) != 0 )	{
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete files from Mercurial repository %s' , $mercurial->get_reponame ));
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete files from Mercurial repository %s' , $mercurial->get_reponame ));
-	}
-
-	if( $mercurial->delete < 0 ) {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Cannot delete Mercurial repository object %s' , $mercurial->get_reponame ));
-	} else {
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Delete Mercurial repository object %s' , $mercurial->get_reponame ));
-	}
-}
-
-Vhffs::Robots::unlock( $vhffs , 'mercurial' );
-exit 0;

Deleted: trunk/vhffs-robots/src/mercurial_public.pl
===================================================================
--- trunk/vhffs-robots/src/mercurial_public.pl	2012-02-25 00:50:48 UTC (rev 2049)
+++ trunk/vhffs-robots/src/mercurial_public.pl	2012-02-25 01:15:53 UTC (rev 2050)
@@ -1,71 +0,0 @@
-#!%PERL%
-# Copyright (c) vhffs project and its contributors
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions 
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright 
-#   notice, this list of conditions and the following disclaimer.
-#2. Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in 
-#   the documentation and/or other materials provided with the 
-#   distribution.
-#3. Neither the name of vhffs nor the names of its contributors 
-#   may be used to endorse or promote products derived from this 
-#   software without specific prior written permission.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
-#LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-#FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-#COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-#INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-#BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
-#LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use utf8;
-
-use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Main;
-use Vhffs::Robots;
-use Vhffs::Robots::Mercurial;
-use Vhffs::Services::Mercurial;
-use Vhffs::Constants;
-
-
-my $vhffs = init Vhffs::Main;
-
-Vhffs::Robots::lock( $vhffs , 'mercurial' );
-
-my $repos = Vhffs::Services::Mercurial::getall( $vhffs , Vhffs::Constants::WAITING_FOR_MODIFICATION );
-foreach my $mercurial ( @{$repos} )
-{
-	if( $mercurial->is_public == 1 ) {
-		chmod 02775 , $mercurial->get_dir;
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Mercurial status %s is now public' , $mercurial->get_dir ) );
-	} else {
-		chmod 02770 , $mercurial->get_dir;
-		Vhffs::Robots::vhffs_log( $vhffs, sprintf( 'Mercurial status %s is now private' , $mercurial->get_dir ) );
-	}
-
-	Vhffs::Robots::Mercurial::change_conf( $mercurial );
-	$mercurial->set_status( Vhffs::Constants::ACTIVATED );
-	
-	if( $mercurial->commit < 0 ) {
-		$mercurial->add_history( 'Error while updating repository configuration' );
-	} else {
-		$mercurial->add_history( 'Successfully modify repository configuration' );
-	}
-}
-
-
-Vhffs::Robots::unlock( $vhffs , 'mercurial' );
-
-exit 0;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/