]> git.mjollnir.org Git - cil.git/commitdiff
Fix up some problems with setting the VCS.
authorAndrew Chilton <andychilton@gmail.com>
Mon, 14 Jul 2008 11:37:53 +0000 (23:37 +1200)
committerAndrew Chilton <andychilton@gmail.com>
Mon, 14 Jul 2008 11:37:53 +0000 (23:37 +1200)
lib/CIL.pm
lib/CIL/VCS/Factory.pm
lib/CIL/VCS/Null.pm

index 1049f592218604b9519ebfa7be9004bc3e5d4046..72676f1934cb876aa3df25bc29f6526dead1eaae 100644 (file)
@@ -42,6 +42,7 @@ my $defaults = {
     IssueDir     => 'issues', # the dir to save the issues in
     StatusStrict => 0,        # whether to complain if a status is invalid
     LabelStrict  => 0,        # whether to complain if a label is invalid
+    VCS          => 'Null',   # don't do anything for VCS hooks
 };
 
 my @config_hashes = qw(StatusAllowed StatusOpen StatusClosed LabelAllowed);
@@ -265,11 +266,9 @@ sub read_config_file {
     $self->LabelAllowed( $cfg->{LabelAllowed} );
 
     # if we are allowed this VCS, create the hook instance
-    if ( exists $allowed->{vcs}{$cfg->{VCS}} ) {
-        $self->VCS( $cfg->{VCS} );
-        my $vcs = CIL::VCS::Factory->new( $cfg->{VCS} );
-        $self->vcs( $vcs );
-    }
+    $self->VCS( $cfg->{VCS} || 'Null' );
+    my $vcs = CIL::VCS::Factory->new( $cfg->{VCS} );
+    $self->vcs( $vcs );
 }
 
 sub register_hook {
index 7b427e9c9d78db71b1095e4c9282a74f25427294..ec5da5378e34d02be64e1af17758ba9a35edff35 100644 (file)
@@ -27,6 +27,7 @@ use Carp;
 
 use base qw( Class::Factory );
 
+__PACKAGE__->register_factory_type( Null => 'CIL::VCS::Null' );
 __PACKAGE__->register_factory_type( Git => 'CIL::VCS::Git' );
 
 foreach my $method_name ( qw(post_add) ) {
index b062771f4d18e13dfe78d81252aba27e79b25953..4cef1a482a7f99e288d375e3e8d869b55df6a110 100644 (file)
@@ -25,9 +25,11 @@ use strict;
 use warnings;
 use Carp;
 
+use base qw(CIL::VCS::Factory);
+
 foreach my $method_name ( qw(post_add) ) {
     no strict 'refs';
-    *{"${class}::$method_name"} = sub {};
+    *{"CIL::VCS::Null::$method_name"} = sub {};
 }
 
 ## ----------------------------------------------------------------------------