This had to happen, forgot to attatch the patch.
It's attatched now ;)
Sven Ludwig([EMAIL PROTECTED])@2007.07.12 10:45:29 +0200:
> I've just added a new policy.
>
> This checking of the validity of a status or resolution change is nice,
> but maybe the user just doesn't want to use this feature?
>
> I've added a policy called status_change_valid, it's already working
> with full functionality.
>
> greetz
> Sven
diff -ur ori/system/src/glue/etc/product/glue.conf.template.in
dev/system/src/glue/etc/product/glue.conf.template.in
--- ori/system/src/glue/etc/product/glue.conf.template.in 2007-07-10
15:40:59.000000000 +0200
+++ dev/system/src/glue/etc/product/glue.conf.template.in 2007-07-12
10:45:13.000000000 +0200
@@ -133,6 +133,11 @@
enabled => 1
},
+ # The statuschange must be valid for the bugtracker
+ status_change_valid => {
+ enabled => 1
+ },
+
# All integration activity must originate from a specific SCM
# user. If the SCM system does not provide the SCM user
# information (e.g Subversion running an svnserve daemon with
diff -ur ori/system/src/lib/product/Connection.pm.in
dev/system/src/lib/product/Connection.pm.in
--- ori/system/src/lib/product/Connection.pm.in 2007-07-10 15:40:59.000000000
+0200
+++ dev/system/src/lib/product/Connection.pm.in 2007-07-12 10:47:14.000000000
+0200
@@ -229,6 +229,9 @@
# Policy product_name
$request .= $policies->{ valid_product_name }->{ enabled } . "\n";
+ # Policy status_change_valid
+ $request .= $policies->{ status_change_valid }->{ enabled } . "\n";
+
# Policy resolution_template
$request .= $policies->{ resolution_template }->{ enabled } . "\n";
$request .= $policies->{ resolution_template }->{
resolution_valid_product_name } . "\n";
diff -ur ori/system/src/lib/product/Daemon/Integration.pm.in
dev/system/src/lib/product/Daemon/Integration.pm.in
--- ori/system/src/lib/product/Daemon/Integration.pm.in 2007-07-10
21:12:14.000000000 +0200
+++ dev/system/src/lib/product/Daemon/Integration.pm.in 2007-07-12
10:51:27.000000000 +0200
@@ -147,16 +147,19 @@
}
}
- # Apply policy open_bug_state
- if ( $request->{ policies }->{ open_bug_state }->{ enabled } ) {
- # Verify that the bug against which the activity is issued
- # is in an open bug state
- ($ret, $bug_state) =
$self->bugtracker()->integration_bug_in_active_state( $bugid );
- if ( $ret == 0) {
- $ret_message = "Bug '$bugid' is in the '$bug_state' state,
instead of the " . $self->bugtracker()->integration_active_states_list() .
".\n";
- $request->add_result(1, $ret_message);
- }
- }
+ # Apply policy status_change_valid
+ if ( $request->{ policies }->{ status_change_valid }->{ enabled } ) {
+ # Apply policy open_bug_state
+ if ( $request->{ policies }->{ open_bug_state }->{ enabled } ) {
+ # Verify that the bug against which the activity is issued
+ # is in an open bug state
+ ($ret, $bug_state) =
$self->bugtracker()->integration_bug_in_active_state( $bugid );
+ if ( $ret == 0) {
+ $ret_message = "Bug '$bugid' is in the '$bug_state' state, instead
of the " . $self->bugtracker()->integration_active_states_list() . ".\n";
+ $request->add_result(1, $ret_message);
+ }
+ }
+ }
}
@@ -208,16 +211,18 @@
}
}
-
- # Verify that the resolution status change is valid
- my ( $resolution_change_retval, $current_resolution_state ) =
$self->bugtracker()->integration_bug_resolution_change_is_valid(
$resolution_id, $request->{ resolution_ids }->{ $resolution_id }->{ status },
$request->{ resolution_ids }->{ $resolution_id }->{ resolution } );
- if ( $resolution_change_retval == 1 ) {
- $ret_message = "Resolving bug '$resolution_id' from state
'$current_resolution_state' to state '" . $request->{ resolution_ids }->{
$resolution_id }->{ status }. "' would violate the workflow of the bug-tracker.
Instead, the resolution state could be changed to " .
$self->bugtracker()->integration_valid_resolution_states_list(
$current_resolution_state ) . ".\n";
- $request->add_result(1, $ret_message);
- } elsif ( $resolution_change_retval == 2 ) {
- $ret_message = "Invalid resolution '" . $request->{
resolution_ids }->{ $resolution_id }->{ resolution } . "' when resolving bug
'$resolution_id' from state '$current_resolution_state' to state '" .
$request->{ resolution_ids }->{ $resolution_id }->{ status }. "'. Instead, a
valid resolution could be " .
$self->bugtracker()->integration_valid_resolutions_list(
$current_resolution_state ) . ".\n";
- $request->add_result(1, $ret_message);
- }
+ # Apply policy status_change_valid
+ if ( $request->{ policies }->{ status_change_valid }->{ enabled } ) {
+ # Verify that the resolution status change is valid
+ my ( $resolution_change_retval, $current_resolution_state ) =
$self->bugtracker()->integration_bug_resolution_change_is_valid(
$resolution_id, $request->{ resolution_ids }->{ $resolution_id }->{ status },
$request->{ resolution_ids }->{ $resolution_id }->{ resolution } );
+ if ( $resolution_change_retval == 1 ) {
+ $ret_message = "Resolving bug '$resolution_id' from state
'$current_resolution_state' to state '" . $request->{ resolution_ids }->{
$resolution_id }->{ status }. "' would violate the workflow of the bug-tracker.
Instead, the resolution state could be changed to " .
$self->bugtracker()->integration_valid_resolution_states_list(
$current_resolution_state ) . ".\n";
+ $request->add_result(1, $ret_message);
+ } elsif ( $resolution_change_retval == 2 ) {
+ $ret_message = "Invalid resolution '" . $request->{ resolution_ids
}->{ $resolution_id }->{ resolution } . "' when resolving bug '$resolution_id'
from state '$current_resolution_state' to state '" . $request->{ resolution_ids
}->{ $resolution_id }->{ status }. "'. Instead, a valid resolution could be " .
$self->bugtracker()->integration_valid_resolutions_list(
$current_resolution_state ) . ".\n";
+ $request->add_result(1, $ret_message);
+ }
+ }
}
}
@@ -379,7 +384,7 @@
if ( $request->{ policies }->{ resolution_template }->{ enabled } ) {
foreach my $resolution_id ( sort keys %{ $request->{ resolution_ids } }
) {
- my ( $retval, $retval_string ) =
$self->bugtracker()->integration_change_bug_resolution( $resolution_id,
$username, $request->{ resolution_ids }->{ $resolution_id }->{ status } );
+ my ( $retval, $retval_string ) =
$self->bugtracker()->integration_change_bug_resolution( $resolution_id,
$username, $request->{ resolution_ids }->{ $resolution_id }->{ status },
$request->{ resolution_ids }->{ $resolution_id }->{ resolution });
if ( $retval != 0) {
$request->add_result( 1, $retval_string );
return 1;
diff -ur ori/system/src/lib/product/Daemon/Process.pm.in
dev/system/src/lib/product/Daemon/Process.pm.in
--- ori/system/src/lib/product/Daemon/Process.pm.in 2007-07-10
15:41:00.000000000 +0200
+++ dev/system/src/lib/product/Daemon/Process.pm.in 2007-07-12
10:48:15.000000000 +0200
@@ -430,6 +430,11 @@
$line =~ s/\n$//g;
$request->{ policies }->{ valid_product_name }->{ enabled } = $line;
+ # Retrieve the valid_product_name policy
+ $line = <$socket>;
+ $line =~ s/\n$//g;
+ $request->{ policies }->{ status_change_valid }->{ enabled } = $line;
+
# Retrieve the resolution_template policy
$line = <$socket>;
$line =~ s/\n$//g;
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users