[svk-commit] r2639 - in branches/bm: lib/SVK t/bm
nobody at bestpractical.com
nobody at bestpractical.com
Mon Dec 17 04:00:20 EST 2007
Author: clsung
Date: Mon Dec 17 04:00:19 2007
New Revision: 2639
Modified:
branches/bm/lib/SVK/Command/Branch.pm
branches/bm/lib/SVK/Project.pm
branches/bm/t/bm/basic.t
Log:
- add tags() in Project.pm to retrieve all tag branches
- refine --list --all
Modified: branches/bm/lib/SVK/Command/Branch.pm
==============================================================================
--- branches/bm/lib/SVK/Command/Branch.pm (original)
+++ branches/bm/lib/SVK/Command/Branch.pm Mon Dec 17 04:00:19 2007
@@ -126,11 +126,24 @@
return;
}
- my $branches = $proj->branches ($self->{local});
- push @{$branches},@{$proj->branches (!$self->{local})} if ($self->{all});
+ if ($self->{all}) {
+ my $fmt = "%s%s\n"; # here to change layout
- my $fmt = "%s\n"; # here to change layout
- printf $fmt, $_ for @{$branches};
+ my $branches = $proj->branches (0); # branches
+ printf $fmt, $_, '' for @{$branches};
+
+ $branches = $proj->tags (); # tags
+ printf $fmt, $_, ' (tags)' for @{$branches};
+
+ $branches = $proj->branches (1); # local branches
+ printf $fmt, $_, ' (in local)' for @{$branches};
+
+ } else {
+ my $branches = $proj->branches ($self->{local});
+
+ my $fmt = "%s\n"; # here to change layout
+ printf $fmt, $_ for @{$branches};
+ }
return;
}
Modified: branches/bm/lib/SVK/Project.pm
==============================================================================
--- branches/bm/lib/SVK/Project.pm (original)
+++ branches/bm/lib/SVK/Project.pm Mon Dec 17 04:00:19 2007
@@ -83,6 +83,17 @@
@{ $self->_find_branches( $root, $branch_location ) } ];
}
+sub tags {
+ my $self = shift;
+
+ my $fs = $self->depot->repos->fs;
+ my $root = $fs->revision_root( $fs->youngest_rev );
+ my $tag_location = $self->tag_location;
+
+ return [ apply {s{^\Q$tag_location\E/}{}}
+ @{ $self->_find_branches( $root, $tag_location ) } ];
+}
+
sub _find_branches {
my ( $self, $root, $path ) = @_;
my $pool = SVN::Pool->new_default;
Modified: branches/bm/t/bm/basic.t
==============================================================================
--- branches/bm/t/bm/basic.t (original)
+++ branches/bm/t/bm/basic.t Mon Dec 17 04:00:19 2007
@@ -65,5 +65,5 @@
['feature/foobar']);
is_output($svk, 'br', ['-l', '--all', '//mirror/MyProject'],
- ['Foo', 'feature/foo', 'feature/foobar']);
+ ['Foo', 'feature/foo', 'feature/foobar (in local)']);
More information about the svk-commit
mailing list