[Bps-public-commit] r10906 - in svb: lib lib/SVB lib/SVB/Model

jesse at bestpractical.com jesse at bestpractical.com
Thu Feb 21 00:50:31 EST 2008


Author: jesse
Date: Thu Feb 21 00:50:25 2008
New Revision: 10906

Added:
   svb/bin/svb-history
   svb/bin/svb-show
   svb/bin/svb-update
   svb/lib/SVB/
   svb/lib/SVB/Model/
   svb/lib/SVB/Model/Bug.pm
   svb/lib/SVB/Record.pm
Modified:
   svb/bin/svb-create
   svb/bin/svb-ls
   svb/lib/SVB.pm

Log:
 continued sketching

Modified: svb/bin/svb-create
==============================================================================
--- svb/bin/svb-create	(original)
+++ svb/bin/svb-create	Thu Feb 21 00:50:25 2008
@@ -3,6 +3,7 @@
 use strict;
 
 use SVB;
+use SVB::Model::Bug;
 
 my %args = @ARGV;
 my %props;
@@ -15,8 +16,9 @@
 
 }
 
-
+for(1..25000) {
 my $svb = SVB->new();
-my $bug = SVN::PropDB::Record->new(handle => $svb->handle, type => 'bug');
-$bug->create( props =>{%props});
+my $bug = SVB::Model::Bug->new(handle => $svb->handle);
+my ($id, $results)= $bug->create( props =>{%props});
 print "Created bug ".$bug->uuid."\n";
+}

Added: svb/bin/svb-history
==============================================================================
--- (empty file)
+++ svb/bin/svb-history	Thu Feb 21 00:50:25 2008
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use SVB;
+
+my $regex;
+my $uuid = shift @ARGV;
+
+my $svb = SVB->new();
+
+my $bug = SVB::Model::Bug->new( handle => $svb->handle);
+$bug->load(uuid => $uuid);
+
+print "id: ".$bug->uuid."\n";
+my $props = $bug->get_props();
+
+for (keys %$props) {
+print $_.": ".$props->{$_}."\n";
+}
+
+
+my @history;
+use YAML;
+SVN::Repos::history ($svb->handle->repo_handle->fs, $bug->storage_node,
+                         sub {push @history, [@_]}, 0, $svb->handle->repo_handle->fs->youngest_rev, 1);
+
+warn YAML::Dump(\@history);
+    

Modified: svb/bin/svb-ls
==============================================================================
--- svb/bin/svb-ls	(original)
+++ svb/bin/svb-ls	Thu Feb 21 00:50:25 2008
@@ -15,11 +15,13 @@
 my $bugs = SVN::PropDB::Collection->new(handle => $svb->handle, type => 'bug');
 $bugs->matching( sub {
             my $item = shift; 
-            map { return 1 if $item->prop(name => $_) =~ $regex} keys %{ $item->get_props};
+            warn "Looking at $item->uuid";
+            my $props = $item->get_props;
+            map { return 1 if $props->{$_} =~ $regex} keys %$props;
             return 0
             });
 
 for (@{$bugs->as_array_ref}) {
-    printf ("%s %s %s \n", $_->uuid, $_->prop(name => 'subject')||"(no subject)", $_->prop(name => 'status')||'(no summary)');
+    printf ("%s %s %s \n", $_->uuid, $_->prop( 'subject')||"(no subject)", $_->prop('status')||'(no status)');
 
 }

Added: svb/bin/svb-show
==============================================================================
--- (empty file)
+++ svb/bin/svb-show	Thu Feb 21 00:50:25 2008
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use SVB;
+
+my $regex;
+my $uuid = shift @ARGV;
+
+my $svb = SVB->new();
+
+my $bug = SVB::Model::Bug->new( handle => $svb->handle);
+$bug->load(uuid => $uuid);
+
+print "id: ".$bug->uuid."\n";
+my $props = $bug->get_props();
+
+for (keys %$props) {
+print $_.": ".$props->{$_}."\n";
+}
+
+
+
+    

Added: svb/bin/svb-update
==============================================================================
--- (empty file)
+++ svb/bin/svb-update	Thu Feb 21 00:50:25 2008
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+use SVB;
+
+my $regex;
+my $uuid = shift @ARGV;
+my %args = (@ARGV);
+my $svb = SVB->new();
+
+my $bug = SVB::Model::Bug->new( handle => $svb->handle);
+$bug->load(uuid => $uuid);
+
+my %props = ();
+for my $key ( keys %args ){
+    $key =~ /^--(.*)/;
+    $props{$1} = $args{$key};
+    warn YAML::Dump (\%props); use YAML;
+    $bug->set_props(props => \%props);
+}
+
+    

Modified: svb/lib/SVB.pm
==============================================================================
--- svb/lib/SVB.pm	(original)
+++ svb/lib/SVB.pm	Thu Feb 21 00:50:25 2008
@@ -7,6 +7,7 @@
 use SVN::PropDB::Handle;
 use SVN::PropDB::Collection;
 use Path::Class;
+use SVB::Model::Bug;
 
 use base qw/Class::Accessor/;
 __PACKAGE__->mk_accessors(qw/handle/);

Added: svb/lib/SVB/Model/Bug.pm
==============================================================================
--- (empty file)
+++ svb/lib/SVB/Model/Bug.pm	Thu Feb 21 00:50:25 2008
@@ -0,0 +1,38 @@
+use warnings;
+use strict;
+
+package SVB::Model::Bug;
+use base qw/SVB::Record/;
+
+
+sub new { shift->SUPER::new(@_, type => 'bug'); }
+
+
+sub columns { qw(status reproduced owner priority summary) }
+
+sub valid_for_status {
+    return qw(new open fixed wontfix);
+}
+
+
+sub validate_reproduced {
+    my $self = shift;
+    my %args = (@_);
+    return 1 if $args{'props'}->{'reproduced'} =~ /^(?:yes|no)$/;
+}
+
+sub validate_owner {
+    my $self = shift;
+    my %args = (@_);
+    return 1 if $args{'props'}->{'owner'} =~ /@/;
+}
+
+sub valid_for_priority {
+    my $self = shift;
+    my %args = (props => undef, @_);
+
+    return(qw(low medium high));
+
+}
+
+1;

Added: svb/lib/SVB/Record.pm
==============================================================================
--- (empty file)
+++ svb/lib/SVB/Record.pm	Thu Feb 21 00:50:25 2008
@@ -0,0 +1,9 @@
+use warnings;
+use strict;
+
+
+package SVB::Record;
+use base qw/SVN::PropDB::Record/;
+
+
+1;



More information about the Bps-public-commit mailing list