[Bps-public-commit] r16159 - in sd/trunk: .

spang at bestpractical.com spang at bestpractical.com
Mon Sep 29 18:17:34 EDT 2008


Author: spang
Date: Mon Sep 29 18:17:30 2008
New Revision: 16159

Modified:
   sd/trunk/   (props changed)
   sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm

Log:
 r50171 at loki:  spang | 2008-09-29 18:11:10 -0400
 multiple changes in an update should be part of the same changeset


Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm	(original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Update.pm	Mon Sep 29 18:17:30 2008
@@ -27,20 +27,24 @@
 
         no warnings 'uninitialized';
 
-        # set new props but don't add props that didn't change to the changeset
-        foreach my $prop (keys %$props_ref) {
-            my $val = $props_ref->{$prop};
-            $record->set_prop(name => $prop, value => $val)
-                unless $val eq $record->prop($prop);
-        }
-
         # if a formerly existing prop was removed from the output, delete it
+        # (deleting is currently the equivalent of setting to '', and
+        # we want to do this all in one changeset)
         foreach my $prop (keys %{$record->get_props}) {
-            unless ($prop =~ /$do_not_edit/) {
-                $record->delete_prop(name => $prop) if !exists $props_ref->{$prop};
+            unless ($prop =~ $do_not_edit) {
+                $props_ref->{$prop} = '' if !exists $props_ref->{$prop};
             }
         }
 
+        # don't add props that didn't change to the changeset
+        foreach my $prop (keys %$props_ref) {
+            delete $props_ref->{$prop}
+                if $props_ref->{$prop} eq $record->prop($prop);
+        }
+
+        # set the new props
+        $record->set_props( props => $props_ref );
+
         print 'Updated ticket ' . $record->luid . ' (' . $record->uuid . ")\n";
 
         $self->add_comment( content => $comment, uuid => $record->uuid )



More information about the Bps-public-commit mailing list