[vhffs-dev] [1427] Fixes #0000262 on GIT & CVS |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1427
Author: beuss
Date: 2009-06-03 14:26:37 +0200 (Wed, 03 Jun 2009)
Log Message:
-----------
Fixes #0000262 on GIT & CVS
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
trunk/vhffs-api/src/Vhffs/Robots/Git.pm
Modified: trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm 2009-06-03 12:15:31 UTC (rev 1426)
+++ trunk/vhffs-api/src/Vhffs/Robots/Cvs.pm 2009-06-03 12:26:37 UTC (rev 1427)
@@ -80,15 +80,17 @@
sub delete_cvs
{
+ use File::Path;
+ use File::Basename;
my $cvs = shift;
return -1 unless defined $cvs;
my $dir = $cvs->get_dir;
- system('rm -rf '.$dir.' 2>/dev/null');
+ File::Path::rmtree($dir) if(-d $dir);
+ # Remove parent dir if empty (i.e. this group has no move CVSes).
+ my $groupdir = dirname($dir);
+ rmdir $groupdir;
- # TODO: is it a good idea here ?
- $cvs->delete;
-
return 0;
}
Modified: trunk/vhffs-api/src/Vhffs/Robots/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Robots/Git.pm 2009-06-03 12:15:31 UTC (rev 1426)
+++ trunk/vhffs-api/src/Vhffs/Robots/Git.pm 2009-06-03 12:26:37 UTC (rev 1427)
@@ -108,15 +108,17 @@
sub delete_repo
{
+ use File::Path;
+ use File::Basename;
my $git = shift;
return -1 unless defined $git;
+ # Remove GIT dir and group dir if empty
my $dir = $git->get_dir;
- system('rm -rf '.$dir.' 2>/dev/null');
+ File::Path::rmtree($dir) if(-d $dir);
+ my $groupdir = dirname($dir);
+ rmdir($groupdir);
- # TODO: is it a good idea here ?
- $git->delete;
-
return 0;
}