[Bps-public-commit] SD branch, master, updated. 0.73-56-g6ec433d
? sunnavy
sunnavy at bestpractical.com
Wed Apr 28 00:43:17 EDT 2010
The branch, master has been updated
via 6ec433d0d422c2787602d517f93bd768586419c0 (commit)
via a815d197a452b0334ac99b38634cdc11cfe184a2 (commit)
from a035b4c1e1709476ba4eb840ad8e9c42effa680c (commit)
Summary of changes:
lib/App/SD/Replica/gcode/PullEncoder.pm | 53 ++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit a815d197a452b0334ac99b38634cdc11cfe184a2
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Apr 28 12:30:21 2010 +0800
try our best to find each comment's meta info
diff --git a/lib/App/SD/Replica/gcode/PullEncoder.pm b/lib/App/SD/Replica/gcode/PullEncoder.pm
index 52cd1aa..da86c53 100644
--- a/lib/App/SD/Replica/gcode/PullEncoder.pm
+++ b/lib/App/SD/Replica/gcode/PullEncoder.pm
@@ -157,6 +157,7 @@ sub translate_ticket_state {
my $final_state = $self->_translate_final_ticket_state($ticket);
my %earlier_state = %{$final_state};
+ my $pre_txn;
for my $txn ( sort { $b->{'serial'} <=> $a->{'serial'} } @$transactions ) {
$txn->{post_state} = {%earlier_state};
@@ -167,7 +168,7 @@ sub translate_ticket_state {
my $updates = $txn->{object}->updates;
- for my $prop (qw(owner status cc summary)) {
+ for my $prop (qw(owner status summary cc)) {
next unless exists $updates->{$prop};
my $value = delete $updates->{$prop};
$value = '' if ($value eq '----');
@@ -178,6 +179,23 @@ sub translate_ticket_state {
$earlier_state{ $PROP_MAP{$prop} } =
$self->warp_list_to_old_value( $earlier_state{ $PROP_MAP{$prop} },
$value, undef );
+ $txn->{post_state}{ $PROP_MAP{$prop} } = $value;
+ }
+
+
+ if ( $updates->{mergedinto} ) {
+ my $value = delete $updates->{mergedinto};
+ my $is_delete;
+ if ( $value =~ /^-(.*)$/ ) {
+ $is_delete = 1;
+ $value = $1;
+ }
+
+ $earlier_state{ $PROP_MAP{mergedinto} } =
+ $self->warp_list_to_old_value( $earlier_state{mergedinto},
+ $is_delete ? ( undef, $value ) : ( $value, undef ) );
+ $txn->{post_state}{ $PROP_MAP{mergedinto} } = $value
+ unless $is_delete;
}
if ( $updates->{labels} ) {
@@ -207,6 +225,27 @@ sub translate_ticket_state {
}
$txn->{pre_state} = {%earlier_state};
+ $pre_txn->{pre_state} = $txn->{post_state} if $pre_txn;
+ $pre_txn = $txn;
+ }
+
+# XXX try our best to find historical info
+# e.g.
+# comemnt 3 has summary: "foo"
+# comment 4 and 5 don't have summary changes
+# comment 6 has summary: "bar"
+# then we can set comment 4 and 5's summary to 'foo'
+ my @sorted = sort { $b->{'serial'} <=> $a->{'serial'} } @$transactions;
+ for ( my $i = 0 ; $i < @sorted ; $i++ ) {
+ for my $prop (qw(owner status summary cc)) {
+ if ( !$sorted[$i]->{post_state}{ $PROP_MAP{$prop} } ) {
+ ( $sorted[$i]->{post_state}{ $PROP_MAP{$prop} } ) =
+ grep { $_ }
+ map { $_->{post_state}{ $PROP_MAP{$prop} } }
+ @sorted[ $i + 1 .. $#sorted ];
+ $sorted[$i]->{post_state}{ $PROP_MAP{$prop} } ||= '';
+ }
+ }
}
return \%earlier_state, $final_state;
commit 6ec433d0d422c2787602d517f93bd768586419c0
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Apr 28 12:41:23 2010 +0800
cc is kinda different than owner status and summary
diff --git a/lib/App/SD/Replica/gcode/PullEncoder.pm b/lib/App/SD/Replica/gcode/PullEncoder.pm
index da86c53..dcf71ee 100644
--- a/lib/App/SD/Replica/gcode/PullEncoder.pm
+++ b/lib/App/SD/Replica/gcode/PullEncoder.pm
@@ -168,7 +168,7 @@ sub translate_ticket_state {
my $updates = $txn->{object}->updates;
- for my $prop (qw(owner status summary cc)) {
+ for my $prop (qw(owner status summary)) {
next unless exists $updates->{$prop};
my $value = delete $updates->{$prop};
$value = '' if ($value eq '----');
@@ -182,6 +182,18 @@ sub translate_ticket_state {
$txn->{post_state}{ $PROP_MAP{$prop} } = $value;
}
+ if ( $updates->{cc} ) {
+ my $value = delete $updates->{cc};
+ my $is_delete;
+ if ( $value =~ /^-(.*)$/ ) {
+ $is_delete = 1;
+ $value = $1;
+ }
+
+ $earlier_state{ $PROP_MAP{cc} } =
+ $self->warp_list_to_old_value( $earlier_state{cc},
+ $is_delete ? ( undef, $value ) : ( $value, undef ) );
+ }
if ( $updates->{mergedinto} ) {
my $value = delete $updates->{mergedinto};
@@ -237,7 +249,7 @@ sub translate_ticket_state {
# then we can set comment 4 and 5's summary to 'foo'
my @sorted = sort { $b->{'serial'} <=> $a->{'serial'} } @$transactions;
for ( my $i = 0 ; $i < @sorted ; $i++ ) {
- for my $prop (qw(owner status summary cc)) {
+ for my $prop (qw(owner status summary)) {
if ( !$sorted[$i]->{post_state}{ $PROP_MAP{$prop} } ) {
( $sorted[$i]->{post_state}{ $PROP_MAP{$prop} } ) =
grep { $_ }
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list