[Bps-public-commit] r10925 - in svb: . lib lib/SVB/Model
jesse at bestpractical.com
jesse at bestpractical.com
Fri Feb 22 19:23:22 EST 2008
Author: jesse
Date: Fri Feb 22 19:23:21 2008
New Revision: 10925
Added:
svb/bin/svb-rm
Modified:
svb/ (props changed)
svb/bin/svb-create
svb/bin/svb-history
svb/bin/svb-ls
svb/lib/SVB.pm
svb/lib/SVB/Model/Bug.pm
Log:
r27935 at 68-247-247-94: jesse | 2008-02-22 19:23:09 -0500
* history tool works. remove tool works.
Modified: svb/bin/svb-create
==============================================================================
--- svb/bin/svb-create (original)
+++ svb/bin/svb-create Fri Feb 22 19:23:21 2008
@@ -16,9 +16,7 @@
}
-for(1..25000) {
my $svb = SVB->new();
my $bug = SVB::Model::Bug->new(handle => $svb->handle);
my ($id, $results)= $bug->create( props =>{%props});
print "Created bug ".$bug->uuid."\n";
-}
Modified: svb/bin/svb-history
==============================================================================
--- svb/bin/svb-history (original)
+++ svb/bin/svb-history Fri Feb 22 19:23:21 2008
@@ -25,53 +25,26 @@
}
-my @history;
-my @REVS;
-use YAML;
-run($bug->storage_node);
-
-warn YAML::Dump(\@REVS);
-sub _log {
- my( $paths, $rev, $author, $date, $msg, $pool) = @_;
-
- my $data = { rev => $rev, author => $author, date => $date, msg => $msg };
-
- my $root = $svb->handle->repo_handle->fs()->revision_root($rev);
-
- my $subpool = SVN::Pool->new($pool);
- $data->{paths} = {
- map {
- $_ => {
- action => $paths->{$_}->action(),
- copyfrom => $paths->{$_}->copyfrom_path(),
- copyfromrev => $paths->{$_}->copyfrom_rev(),
- props => $root->node_proplist($_),
- isdir => $root->check_path($_, $subpool) == $SVN::Node::dir,
- },
- $subpool->clear()
- } keys %$paths
- };
-
- push @REVS, $data;
+my $nodes = $bug->history;
+for my $node (@$nodes) {
+print "="x40 ."\n";
+print $node->rev.'@'. $node->date .' <'.$node->author.">\n";
+print $node->msg."\n" if ($node->msg);
+for my $key ( keys %{ $node->prop_changes } ) {
+ print "$key ";
+ if ( $node->prop_changes->{$key}->{'add'}
+ && $node->prop_changes->{$key}->{'del'} )
+ {
+
+ print "changed from '"
+ . $node->prop_changes->{$key}->{'add'}
+ . "' to '"
+ . $node->prop_changes->{$key}->{'del'} . "'\n"
+
+ } elsif ( $node->prop_changes->{$key}->{'add'} ) {
+ print "added '" . $node->prop_changes->{$key}->{'add'} . "'\n";
+ } elsif ( $node->prop_changes->{$key}->{'del'} ) {
+ print "removed '" . $node->prop_changes->{$key}->{'del'} . "'\n";
+ }
}
-
-# XXX: stolen from svk::util
-sub run {
- my $path = shift;
-
-
- my $pool = SVN::Pool->new_default_sub;
- my $fs = $svb->handle->repo_handle->fs;
- my $limit = 0;
- my $rev = $fs->youngest_rev();
- my $root = $fs->revision_root($rev);
-
-
-
- my $head = $fs->youngest_rev();
- my $endrev = 0;
-
- $svb->handle->repo_handle->get_logs([$path], $rev, $endrev, 1, 0, sub { _log(@_) });
}
-
-1;
Modified: svb/bin/svb-ls
==============================================================================
--- svb/bin/svb-ls (original)
+++ svb/bin/svb-ls Fri Feb 22 19:23:21 2008
@@ -15,13 +15,12 @@
my $bugs = SVN::PropDB::Collection->new(handle => $svb->handle, type => 'bug');
$bugs->matching( sub {
my $item = shift;
- 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( 'subject')||"(no subject)", $_->prop('status')||'(no status)');
+ printf ("%s %s %s \n", $_->uuid, $_->prop( 'summary')||"(no summary)", $_->prop('status')||'(no status)');
}
Added: svb/bin/svb-rm
==============================================================================
--- (empty file)
+++ svb/bin/svb-rm Fri Feb 22 19:23:21 2008
@@ -0,0 +1,20 @@
+#!/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";
+
+$bug->delete;
+
+
+
Modified: svb/lib/SVB.pm
==============================================================================
--- svb/lib/SVB.pm (original)
+++ svb/lib/SVB.pm Fri Feb 22 19:23:21 2008
@@ -23,7 +23,9 @@
sub _init {
my $self = shift;
- $self->handle( SVN::PropDB::Handle->new( repository => dir($ENV{'HOME'},'.svb'), db_root => '_svb'));
+ my $root = $ENV{'SVB_ROOT'} || dir($ENV{'HOME'},'.svb');
+ my $path = $ENV{'SVB_REPO_PATH'} ||'_svb';
+ $self->handle( SVN::PropDB::Handle->new( repository => $root, db_root => $path ));
};
1;
Modified: svb/lib/SVB/Model/Bug.pm
==============================================================================
--- svb/lib/SVB/Model/Bug.pm (original)
+++ svb/lib/SVB/Model/Bug.pm Fri Feb 22 19:23:21 2008
@@ -7,8 +7,15 @@
sub new { shift->SUPER::new(@_, type => 'bug'); }
+sub _validate_column_name {
+ my $self = shift;
+ my $name = shift;
+ return undef unless grep {$name eq $_ } $self->column_names;
+ return 1;
+
+}
-sub columns { qw(status reproduced owner priority summary) }
+sub column_names { qw(status reproduced owner priority summary) }
sub valid_for_status {
return qw(new open fixed wontfix);
More information about the Bps-public-commit
mailing list