#!/usr/local/bin/perl -w use strict; use VCP::Debug qw( :debug ); BEGIN { enable_debug ".*"; } use VCP::MainBranchIdDB; my $db = VCP::MainBranchIdDB->new( @ARGV ? ( StoreLoc => shift ) : () ); $db->open_existing_db; my( @keys, %vals ); my @w; while ( my ( $k, $v ) = each %{$db->{Store}->{Hash}} ) { my @key = $db->{Store}->unpack_values( $k ); for ( my $i = 0; $i <= $#key; ++$i ) { $w[$i] = length $key[$i] if ! defined $w[$i] || length $key[$i] > $w[$i]; } push @keys, \@key; $vals{$k} = [ $db->{Store}->unpack_values( $v ) ]; } ## This does not take file separators in to account, but that's ok ## for a debugging tool and the ids that are used as key values ## are supposed to be opaque anyway @keys = sort @keys; my $f = join( " ", map "%-${w[$_]}s", 0..$#w) . " => %s\n"; while ( @keys ) { my @k = @{shift @keys}; my @v = map { "'$_'" } @{$vals{$db->{Store}->pack_values( @k )}}; printf $f, @k, @v == 1 ? $v[0] : join join( ",", @v ), "(", ")"; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 2959 | John Fetkovich |
added dump method to lib/VCP/DB_File/sdbm.pm to dump keys => values from a sdbm file. removed similar code from bin/dump_head_revs, bin/dump_rev_map and bin/dump_main_branch_id and called this method instead. also made parse_files_and_revids_from_head_revs_db sub in TestUtils to use in test suites instead of parse_files_and_revids_from_p4_files et. al. |
||
#1 | 2873 | Barrie Slaymaker | Add MainBranchIdDB and a dump util. |