summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2005-12-14 08:50:24 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2005-12-14 08:50:24 +0000
commit34e01876b9705b550e9e84c2a2f104824c4e9f84 (patch)
treed57aa18c751cbc93260603ac9c6d33cf3bba74a1
parent265dc96c45a3fed0191ccd287a5d2e6a5c3e04c0 (diff)
INTEGRATION: CWS hr25 (1.12.68); FILE MERGED
2005/12/09 17:17:48 hr 1.12.68.1: #i59149#: implement the cloning of a CWS
-rwxr-xr-xsolenv/bin/modules/Cws.pm82
1 files changed, 76 insertions, 6 deletions
diff --git a/solenv/bin/modules/Cws.pm b/solenv/bin/modules/Cws.pm
index 3b39b9ea0038..ef3824303918 100755
--- a/solenv/bin/modules/Cws.pm
+++ b/solenv/bin/modules/Cws.pm
@@ -4,9 +4,9 @@
#
# $RCSfile: Cws.pm,v $
#
-# $Revision: 1.12 $
+# $Revision: 1.13 $
#
-# last change: $Author: kz $ $Date: 2005-11-03 10:32:47 $
+# last change: $Author: rt $ $Date: 2005-12-14 09:50:24 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
@@ -315,6 +315,12 @@ sub get_tags
return undef;
}
+ my $childws = $self->child();
+ # check if child workspace is a clone,
+ if ( $childws =~ /(\w+)_[[:upper:]]{3}\d{3}/ ) {
+ $childws = $1;
+ }
+
# check in environment if master is on the the HEAD branch
my $cvs_head = get_cvs_head();
my $current_master = $self->master();
@@ -327,7 +333,7 @@ sub get_tags
my $master_branch_tag
= (lc($current_master) eq lc($cvs_head)) ? '' : 'mws_' . lc($current_master);
- my $cws_branch_tag = 'cws_' . lc($creation_master) . '_' . lc($self->child());
+ my $cws_branch_tag = 'cws_' . lc($creation_master) . '_' . lc($childws);
my $cws_root_tag = uc($cws_branch_tag) . "_ANCHOR";
my $master_milestone_tag = uc($current_master) . "_" . $milestone;
@@ -489,8 +495,8 @@ sub get_cws_with_state
my $mws = shift;
my $status = shift;
- return wantarray ? @{$self->get_cws_with_state_from_ice($mws, $status)}
- : $self->get_cws_with_state_from_ice($mws, $status);
+ return wantarray ? @{$self->get_cws_with_state_from_eis($mws, $status)}
+ : $self->get_cws_with_state_from_eis($mws, $status);
}
sub get_task_prio_cws
@@ -500,6 +506,24 @@ sub get_task_prio_cws
return @{$self->get_task_prios_of_tasks($ref_taskids)};
}
+# Check is CWS is cloneable for specified master
+sub is_cws_cloneable
+{
+ my $self = shift;
+ my $master = shift;
+
+ return $self->get_is_cws_cloneable_from_eis($master);
+}
+
+# Clone CWS for specified master
+sub clone_cws
+{
+ my $self = shift;
+ my $master = shift;
+
+ return $self->clone_cws_in_eis($master);
+}
+
sub set_log_entry
{
my $self = shift;
@@ -1171,7 +1195,7 @@ sub get_childworkspaces_for_milestone
return $result;
}
-sub get_cws_with_state_from_ice {
+sub get_cws_with_state_from_eis {
my $self = shift;
my $mws = shift;
my $status = shift;
@@ -1331,6 +1355,52 @@ sub set_l10n_status_from_eis
return $result;
}
+sub get_is_cws_cloneable_from_eis
+{
+ my $self = shift;
+ my $master = Eis::to_string( shift );
+
+ # check if child workspace is valid
+ my $id = $self->eis_id();
+ if ( !$id ) {
+ carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
+ return undef;
+ }
+
+ my $eis = Cws::eis();
+ my $result;
+
+ eval { $result = $eis->isClonableForMaster($id, $master) };
+ if ( $@ ) {
+ carp("ERROR: get_is_cws_cloneable_from_eis(): EIS database transaction failed. Reason:\n$@\n");
+ }
+
+ return $result;
+}
+
+sub clone_cws_in_eis
+{
+ my $self = shift;
+ my $master = Eis::to_string( shift );
+
+ # check if child workspace is valid
+ my $id = $self->eis_id();
+ if ( !$id ) {
+ carp("ERROR: Childworkspace not (yet) registered with EIS.\n");
+ return undef;
+ }
+
+ my $eis = Cws::eis();
+ my $result;
+
+ eval { $eis->cloneForMaster($id, $master) };
+ if ( $@ ) {
+ carp("ERROR: clone_cws_in_eis(): EIS database transaction failed. Reason:\n$@\n");
+ return 0;
+ }
+
+ return 1;
+}
#logging