package VCP::Dest::branch_diagram ; =head1 NAME VCP::Dest::branch_diagram - An experimental diagram drawing "destination" =head1 SYNOPSIS =head1 DESCRIPTION This generates (using GraphViz) a diagram of the branch structure of the source repository. =head1 METHODS =over =cut $VERSION = 1 ; use strict ; use Carp ; use File::Basename ; use File::Path ; use Getopt::Long ; use VCP::Debug ':debug' ; use VCP::Dest ; use VCP::Branches ; use VCP::Branch ; use VCP::Rev ; use GraphViz; use base qw( VCP::Dest ) ; use fields ( 'BD_GRAPH', ## The graph being built 'BD_BRANCH_COLORS', ## We color code branches ) ; =item new Creates a new instance of a VCP::Dest::branch_diagram. =cut sub new { my $class = shift ; $class = ref $class || $class ; my VCP::Dest::branch_diagram $self = $class->SUPER::new( @_ ) ; ## Parse the options my ( $spec, $options ) = @_ ; $self->parse_repo_spec( $spec ) ; GetOptions( "ArGhOpTioN" => \"" ) or $self->usage_and_exit ; # No options! return $self ; } sub backfill { my VCP::Dest::branch_diagram $self = shift ; my VCP::Rev $r ; ( $r ) = @_ ; confess unless defined $self && defined $self->header ; return 1 ; } sub handle_header { my VCP::Dest::branch_diagram $self = shift ; $self->SUPER::handle_header( @_ ) ; $self->{BD_GRAPH} = GraphViz->new( rankdir => "LR", nodesep => 0.1, ranksep => 0.1, ordering => "out", ); my @colors = qw( brown red green blue ); for ( $self->header->{branches}->get ) { my $c = shift @colors; @colors = ( @colors, $c ); $self->{BD_BRANCH_COLORS}->{$_->branch_id} = $c; } } sub handle_rev { my VCP::Dest::branch_diagram $self = shift ; my VCP::Rev $r ; ( $r ) = @_ ; debug "vcp: handle_rev got $r ", $r->name if debugging $self ; my $g = $self->{BD_GRAPH}; my $label = join( "", $r->name, "#", $r->rev_id, defined $r->branch_id ? join $r->branch_id, " (", ")" : (), ); my @color; @color = ( color => $self->{BD_BRANCH_COLORS}->{$r->branch_id} ) if defined $r->branch_id; $g->add_node( join( "#", $r->name, $r->rev_id ), label => $label, fontsize => 10, fontname => "Helvetica", shape => "box", height => 0, width => 0, @color, ); my $saw = $self->seen( $r ); my $base_rev_id = defined $r->base_rev_id ? $r->base_rev_id : defined $saw ? $saw->rev_id : undef; my @style; @style = ( style => "dashed" ) unless defined $r->base_rev_id; if ( defined $base_rev_id ) { $g->add_edge( { from => join( "#", $r->name, $base_rev_id ), to => join( "#", $r->name, $r->rev_id ), @color, @style, } ); } } sub handle_footer { my VCP::Dest::branch_diagram $self = shift ; my $fn = $self->repo_filespec; my ( $ext ) = ( $fn =~ /\.([^.]*)\z/ ); my $method = "as_$ext"; $self->{BD_GRAPH}->$method( $fn ); } =back =head1 AUTHOR Barrie Slaymaker <barries@slaysys.com> =head1 COPYRIGHT Copyright (c) 2000, 2001, 2002 Perforce Software, Inc. All rights reserved. See L<VCP::License|VCP::License> (C<vcp help license>) for the terms of use. =cut 1
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#26 | 4021 | barrie_slaymaker |
- Remove all phashes and all base & fields pragmas - Work around SWASHGET error |
||
#25 | 4012 | barrie_slaymaker | - Remove dependance on pseudohashes (deprecated Perl feature) | ||
#24 | 3858 | barrie_slaymaker | - Final tweaks for 0.5 release | ||
#23 | 3813 | barrie_slaymaker | - VCP::Rev::previous() is no more | ||
#22 | 3532 | john_fetkovich |
changed File::Spec->rel2abs( blah, start_dir ) to start_dir_rel2abs blah everywhere. which does the same thing and is defined in VCP::Utils |
||
#21 | 3489 | barrie_slaymaker | - Document options emitted to .vcp files. | ||
#20 | 3460 | barrie_slaymaker |
- Revamp Plugin/Source/Dest hierarchy to allow for reguritating options in to .vcp files |
||
#19 | 3400 | barrie_slaymaker |
- Make dest file be relative to vcp's starting dir - Print and log the dest file location for the user to see |
||
#18 | 3208 | john_fetkovich | documentation (pod) fixes. | ||
#17 | 3133 | barrie_slaymaker |
Make destinations call back to sources to check out files to simplify the architecture (is_metadata_only() no longer needed) and make it more optimizable (checkouts can be batched). |
||
#16 | 3019 | barrie_slaymaker | Display the action/placeholder/base rev status | ||
#15 | 2929 | john_fetkovich | added empty() call | ||
#14 | 2838 | john_fetkovich | Use parse_options rather than using Getopt::Long directly. | ||
#13 | 2802 | john_fetkovich |
Added a source_repo_id to each revision, and repo_id to each Source and Dest. The repo_ids include repository type (cvs,p4,revml,vss,...) and the repo_server fields. Changed the $self->...->set() and $self->...->get() lines in VCP::Dest::* to pass in a conglomerated key value, by passing in the key as an ARRAY ref. Also various restructuring in VCP::DB.pm, VCP::DB_file.pm and VCP::DB_file::sdbm.pm related to this change. |
||
#12 | 2753 | john_fetkovich | POD fixes | ||
#11 | 2329 | barrie_slaymaker | Silly GraphViz seems to bungle colors. Should sniff the version. | ||
#10 | 2322 | barrie_slaymaker | Fix jack-in-the-bug options parsing exposed by .vcp files | ||
#9 | 2200 | barrie_slaymaker | Add some examples to branch_diagram.pm | ||
#8 | 2148 | barrie_slaymaker |
Elide the middle of the list of labels so revs with many labels aren't huge |
||
#7 | 2042 | barrie_slaymaker | Basic source::p4 branching support | ||
#6 | 2026 | barrie_slaymaker | VCP::8::cvs now supoprt branching | ||
#5 | 2017 | barrie_slaymaker |
Interim checkin of id=/base_version_id for revml: and branch_diagram: |
||
#4 | 2015 | barrie_slaymaker | submit changes | ||
#3 | 2011 | barrie_slaymaker | Tweak images to be smaller, more readable (IMHO) | ||
#2 | 2009 | barrie_slaymaker |
lots of fixes, improve core support for branches and VCP::Source::cvs now supports branches. |
||
#1 | 2006 | barrie_slaymaker |
more preparations for branching support, handling of cvs :foo:... CVSROOT specs, misc fixes, improvements |