[Bps-public-commit] App-Changeloggr branch, master, updated. 55538ed5e8469041ad7e5cd20de780d39652542e

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 30 14:15:51 EDT 2009


The branch, master has been updated
       via  55538ed5e8469041ad7e5cd20de780d39652542e (commit)
       via  4f5258b4bb6632ecfa22982e86e0d19a13275a34 (commit)
      from  0ad4c26210d5531c77a02fd89b0f557dbd131869 (commit)

Summary of changes:
 bin/flip-changes                    |   37 +++++++++++++++++++++++++++++++++++
 lib/App/Changeloggr/Model/Change.pm |    7 ++++++
 2 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 bin/flip-changes

- Log -----------------------------------------------------------------
commit 4f5258b4bb6632ecfa22982e86e0d19a13275a34
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Jul 30 14:14:50 2009 -0400

    First stab at a script that flips the changes around

diff --git a/bin/flip-changes b/bin/flip-changes
new file mode 100644
index 0000000..3545f0c
--- /dev/null
+++ b/bin/flip-changes
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Jifty;
+BEGIN { Jifty->new }
+
+my $changelogs = App::Changeloggr::Model::ChangelogCollection->new(
+    current_user => App::Changeloggr::CurrentUser->superuser,
+);
+$changelogs->unlimit;
+
+while (my $changelog = <$changelogs>) {
+    my $changes = $changelog->changes;
+    while (my $change = <$changes>) {
+        my %values = $change->as_hash;
+        delete $values{id};
+
+        my $new_change = App::Changeloggr::Model::Change->new(
+            current_user => App::Changeloggr::CurrentUser->superuser,
+        );
+        my ($ok, $msg) = $new_change->create(%values);
+        print "created $ok - $msg\n";
+
+        my $votes = $change->votes;
+        while (my $vote = <$votes>) {
+            $vote->__set(
+                column => 'change_id',
+                value  => $new_change->id,
+            );
+        }
+
+        ($ok, $msg) = $change->delete;
+        print "deleted $ok - $msg\n";
+    }
+}
+

commit 55538ed5e8469041ad7e5cd20de780d39652542e
Author: Shawn M Moore <sartak at gmail.com>
Date:   Thu Jul 30 14:15:45 2009 -0400

    Change->rewordings

diff --git a/lib/App/Changeloggr/Model/Change.pm b/lib/App/Changeloggr/Model/Change.pm
index d47b262..9af43ab 100644
--- a/lib/App/Changeloggr/Model/Change.pm
+++ b/lib/App/Changeloggr/Model/Change.pm
@@ -64,6 +64,13 @@ sub votes {
     return $votes;
 }
 
+sub rewordings {
+    my $self = shift;
+    my $rewordings = App::Changeloggr::Model::RewordingCollection->new;
+    $rewordings->limit( column => 'change_id', value => $self->id );
+    return $rewordings;
+}
+
 sub grouped_votes {
     my $self = shift;
     my $votes = $self->votes;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list