[vhffs-dev] [1425] SVN fix for #0000262 |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1425
Author: beuss
Date: 2009-06-03 11:53:15 +0200 (Wed, 03 Jun 2009)
Log Message:
-----------
SVN fix for #0000262
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
trunk/vhffs-api/src/Vhffs/Services/Svn.pm
Modified: trunk/vhffs-api/src/Vhffs/Robots/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2009-06-03 05:43:32 UTC (rev 1424)
+++ trunk/vhffs-api/src/Vhffs/Robots/Svn.pm 2009-06-03 09:53:15 UTC (rev 1425)
@@ -164,14 +164,27 @@
sub delete_repo
{
+ use File::Path;
+ use File::Basename;
my $svn = shift;
return -1 unless defined $svn;
my $dir = $svn->get_dir;
- system('rm -rf '.$dir.' 2>/dev/null');
+ my $basedir = $svn->get_base_dir;
+ $basedir =~ s/\/$//;
- # TODO: is it a good idea here ?
- $svn->delete;
+ while(1) {
+ print "Removing $dir\n";
+ File::Path::rmtree($dir);
+ $dir = dirname($dir);
+ print "New dir is: $dir\n";
+ last if($dir eq $basedir);
+ opendir DIR, $dir;
+ my @files = readdir DIR;
+ closedir DIR;
+ # Exit if we've more than . and ..
+ last if(scalar(@files) != 2);
+ }
return 0;
}
Modified: trunk/vhffs-api/src/Vhffs/Services/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2009-06-03 05:43:32 UTC (rev 1424)
+++ trunk/vhffs-api/src/Vhffs/Services/Svn.pm 2009-06-03 09:53:15 UTC (rev 1425)
@@ -255,7 +255,15 @@
return $svn;
}
+=head2 get_dir
+ $svn->get_dir();
+
+Returns the directory containing the current repository
+(C<datadir>/svn/svnroot/groupname/repository).
+
+=cut
+
sub get_dir
{
my $self = shift;
@@ -264,6 +272,20 @@
return( $self->{'main'}->get_config->get_datadir . "/svn/svnroot/" . $self->get_reponame );
}
+=head2 get_base_dir
+ $svn->get_base_dir();
+Returns the directory containing all the repositories.
+
+=cut
+
+sub get_base_dir
+{
+ return undef unless( defined $_[0] );
+ return $_[0]->{main}->get_config->get_datadir.'/svn/svnroot/';
+}
+
+
+
1;