Subversion Repositories DevTools

Rev

Rev 1270 | Rev 1328 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1270 Rev 1272
Line 66... Line 66...
66
my $opt_workDir = '/work';
66
my $opt_workDir = '/work';
67
my $opt_vobMap;
67
my $opt_vobMap;
68
my $opt_preserveProjectBase;
68
my $opt_preserveProjectBase;
69
my $opt_ignoreProjectBaseErrors;
69
my $opt_ignoreProjectBaseErrors;
70
my $opt_delete;
70
my $opt_delete;
-
 
71
my $opt_recentAge = 14;             # Days
71
 
72
 
72
################################################################################
73
################################################################################
73
#   List of Projects Suffixes and Branch Names to be used within SVN
74
#   List of Projects Suffixes and Branch Names to be used within SVN
74
#
75
#
75
#       Name        - Name of branch for the project
76
#       Name        - Name of branch for the project
Line 121... Line 122...
121
    '.u244.syd'     => '.syd',
122
    '.u244.syd'     => '.syd',
122
    '.pxxx.sea'     => '.sea',
123
    '.pxxx.sea'     => '.sea',
123
    '.pxxx.syd'     => '.syd',
124
    '.pxxx.syd'     => '.syd',
124
    '.pxxx.sydddd'  => '.syd',
125
    '.pxxx.sydddd'  => '.syd',
125
    '.oslo'         => '.oso',
126
    '.oslo'         => '.oso',
-
 
127
    '.osl'          => '.oso',
126
);
128
);
127
 
129
 
128
my %specialPackages = (
130
my %specialPackages = (
129
    'core_devl' =>  ',all,protected,',
131
    'core_devl' =>  ',all,protected,',
130
#    'core_devl' =>  ',all,',
132
#    'core_devl' =>  ',all,',
Line 210... Line 212...
210
my $noTransfer;
212
my $noTransfer;
211
my $rippleCount = 0;
213
my $rippleCount = 0;
212
my $svnRepo;
214
my $svnRepo;
213
my $processCount = 0;
215
my $processCount = 0;
214
my $processTotal = 0;
216
my $processTotal = 0;
-
 
217
my $recentCount = 0;
215
 
218
 
216
our $GBE_RM_URL;
219
our $GBE_RM_URL;
217
my $UNIX = $ENV{'GBE_UNIX'};
220
my $UNIX = $ENV{'GBE_UNIX'};
218
 
221
 
219
my $result = GetOptions (
222
my $result = GetOptions (
220
                "help+"         => \$opt_help,          # flag, multiple use allowed
223
                "help+"         => \$opt_help,          # flag, multiple use allowed
221
                "manual:3"      => \$opt_help,
224
                "manual:3"      => \$opt_help,
222
                "verbose:+"     => \$opt_verbose,       # Versose
225
                "verbose:+"     => \$opt_verbose,       # Versose
223
                "repository:s"  => \$opt_repo,          # Name of repository
226
                "repository:s"  => \$opt_repo,          # Name of repository
-
 
227
                'rbase:s'       => \$opt_repo_base,     # Base of the repo
224
                "flat!"         => \$opt_flat,          # Flat structure
228
                "flat!"         => \$opt_flat,          # Flat structure
225
                "test!"         => \$opt_test,          # Test operations
229
                "test!"         => \$opt_test,          # Test operations
226
                "reuse!"        => \$opt_reuse,         # Reuse ClearCase views
230
                "reuse!"        => \$opt_reuse,         # Reuse ClearCase views
227
                "age:i"         => \$opt_age,           # Only recent versions
231
                "age:i"         => \$opt_age,           # Only recent versions
228
                "dump:1"        => \$opt_dump,          # Dump Data
232
                "dump:1"        => \$opt_dump,          # Dump Data
Line 852... Line 856...
852
                $entry = $versions{$entry}{last}
856
                $entry = $versions{$entry}{last}
853
            }
857
            }
854
        }
858
        }
855
 
859
 
856
        #
860
        #
-
 
861
        #   Keep recent versions
-
 
862
        #       Keep versions created in the last N days
-
 
863
        #       Will keep recent ripples too
-
 
864
        #
-
 
865
        if ( $pruneMode == 1 )
-
 
866
        {
-
 
867
            foreach my $entry ( keys(%versions) )
-
 
868
            {
-
 
869
                next unless ( $versions{$entry}{Age} <= $opt_recentAge  );
-
 
870
                $versions{$entry}{keepRecent} = 1;
-
 
871
                $recentCount++;
-
 
872
#print "--- Recent version $versions{$entry}{vname}, $versions{$entry}{Age} <= $opt_recentAge\n";
-
 
873
            }
-
 
874
 
-
 
875
#            #
-
 
876
#            #   Keep the tip of each branch
-
 
877
#            #
-
 
878
#            foreach my $entry ( @endPoints )
-
 
879
#            {
-
 
880
#                next if exists $versions{$entry}{keepRecent};
-
 
881
#                $versions{$entry}{keepRecent} = 1;
-
 
882
##print "--- Tip version $versions{$entry}{vname}\n";
-
 
883
#            }
-
 
884
        }
-
 
885
        
-
 
886
        #
857
        #   Keep versions that are common parents to Essential Versions
887
        #   Keep versions that are common parents to Essential Versions
858
        #       Mark paths through the tree to essential versions
888
        #       Mark paths through the tree to essential versions
859
        #       Mark nodes with the number of essential versions that they sprout
889
        #       Mark nodes with the number of essential versions that they sprout
860
        #   Don't do it if we are ripple pruning
890
        #   Don't do it if we are ripple pruning
861
        #
891
        #
Line 919... Line 949...
919
            return 0 if ( $versions{$entry}{newSuffix} && (exists $versions{$entry}{EssentialPath}) );
949
            return 0 if ( $versions{$entry}{newSuffix} && (exists $versions{$entry}{EssentialPath}) );
920
#            return 1 if ( exists $versions{$entry}{DeadWood} );
950
#            return 1 if ( exists $versions{$entry}{DeadWood} );
921
            return 0 if ( exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
951
            return 0 if ( exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
922
            return 0 if ( exists $versions{$entry}{keepLowestRipple} &&  $versions{$entry}{keepLowestRipple} );
952
            return 0 if ( exists $versions{$entry}{keepLowestRipple} &&  $versions{$entry}{keepLowestRipple} );
923
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
953
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
-
 
954
            return 0 if ( exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
924
            return 1;
955
            return 1;
925
        }
956
        }
926
 
957
 
927
        foreach my $entry ( keys(%versions) )
958
        foreach my $entry ( keys(%versions) )
928
        {
959
        {
Line 1118... Line 1149...
1118
    Message("Retained entries: $processTotal" );
1149
    Message("Retained entries: $processTotal" );
1119
    Message("Pruned entries: $pruneCount");
1150
    Message("Pruned entries: $pruneCount");
1120
    Message("Deadwood entries: $trimCount");
1151
    Message("Deadwood entries: $trimCount");
1121
    Message("Bad Singletons: $badSingletonCount");
1152
    Message("Bad Singletons: $badSingletonCount");
1122
    Message("Ripples: $rippleCount");
1153
    Message("Ripples: $rippleCount");
-
 
1154
    Message("Recent entries: $recentCount");
1123
}
1155
}
1124
 
1156
 
1125
sub calculateWalkOrder
1157
sub calculateWalkOrder
1126
{
1158
{
1127
    my ($entry) = @_;
1159
    my ($entry) = @_;
Line 1210... Line 1242...
1210
 
1242
 
1211
#-------------------------------------------------------------------------------
1243
#-------------------------------------------------------------------------------
1212
# Function        : calcRippleGroups
1244
# Function        : calcRippleGroups
1213
#
1245
#
1214
# Description     : Locate and mark ripple groups
1246
# Description     : Locate and mark ripple groups
1215
#                   packages that are ripples fo each other
1247
#                   packages that are ripples of each other
1216
#                       Keep first version of each ripple. Must keep first
1248
#                       Keep first version of each ripple. Must keep first
1217
#                       Group ripples together so that they can be
1249
#                       Group ripples together so that they can be
1218
#                       proccessed at the same time
1250
#                       proccessed at the same time
1219
#
1251
#
1220
# Inputs          : 
1252
# Inputs          : 
Line 1439... Line 1471...
1439
# Inputs          : $data               - Shared data
1471
# Inputs          : $data               - Shared data
1440
#                   $entry              - Package entry to process
1472
#                   $entry              - Package entry to process
1441
#
1473
#
1442
# Returns         : Error Code
1474
# Returns         : Error Code
1443
#                         0 - All is well
1475
#                         0 - All is well
1444
#                       <10 - Recoveralble error
1476
#                       <10 - Recoverable error
1445
#                       >10 - Fatal error
1477
#                       >10 - Fatal error
1446
#
1478
#
1447
sub newPackageVersionBody
1479
sub newPackageVersionBody
1448
{
1480
{
1449
    my ($data, $entry) = @_;
1481
    my ($data, $entry) = @_;
Line 1573... Line 1605...
1573
        #
1605
        #
1574
        #   Look in ViewPath
1606
        #   Look in ViewPath
1575
        #   If it contains only ONE directory then we can suck it up
1607
        #   If it contains only ONE directory then we can suck it up
1576
        #
1608
        #
1577
        my $testDir = findDirWithStuff( $data->{ViewPath} );
1609
        my $testDir = findDirWithStuff( $data->{ViewPath} );
-
 
1610
print "-- findDirWithStuff: Result $data->{ViewPath} --> $testDir\n";
-
 
1611
        
1578
        unless ( $data->{ViewPath} eq $testDir  )
1612
        unless ( $data->{ViewPath} eq $testDir  )
1579
        {
1613
        {
1580
            Message ("Adjust Base Dir: $testDir");
1614
            Message ("Adjust Base Dir: $testDir");
1581
            $data->{adjustedPath} = $data->{ViewPath};
1615
            $data->{adjustedPath} = $data->{ViewPath};
1582
            $data->{ViewPath} = $testDir;
1616
            $data->{ViewPath} = $testDir;
Line 1676... Line 1710...
1676
        $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
1710
        $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
1677
    }
1711
    }
1678
 
1712
 
1679
    unless ( $data->{rmRef}  )
1713
    unless ( $data->{rmRef}  )
1680
    {
1714
    {
1681
        $data->{errStr} = 'Failed to determin Rm Reference';
1715
        $data->{errStr} = 'Failed to determine Rm Reference';
1682
        return 13;
1716
        return 13;
1683
    }
1717
    }
1684
 
1718
 
1685
    Message ("RM Ref: $data->{rmRef}");
1719
    Message ("RM Ref: $data->{rmRef}");
1686
    unlink $datafile;
1720
    unlink $datafile;
Line 2161... Line 2195...
2161
{
2195
{
2162
    my ($base) = @_;
2196
    my ($base) = @_;
2163
 
2197
 
2164
    while ( $base )
2198
    while ( $base )
2165
    {
2199
    {
-
 
2200
print "-- findDirWithStuff: Base: $base\n";
2166
    my $fileCount = 0;
2201
    my $fileCount = 0;
2167
    my $dirCount = 0;
2202
    my $dirCount = 0;
-
 
2203
    my $firstDir;
2168
 
2204
 
2169
    my @list = glob( $base . '/*');
2205
    my @list = glob( $base . '/*');
2170
    foreach ( @list )
2206
    foreach ( @list )
2171
    {
2207
    {
-
 
2208
print "-- findDirWithStuff: Test: $_\n";
-
 
2209
        
2172
        next if ( $_ eq '.' );
2210
        next if ( $_ eq '.' );
2173
        next if ( $_ eq '..' );
2211
        next if ( $_ eq '..' );
2174
        if ( -d $_ )
2212
        if ( -d $_ )
2175
        {
2213
        {
2176
            $dirCount++;
2214
            $dirCount++;
-
 
2215
            $firstDir = $_ unless ( defined $firstDir );
2177
            return $base if ( $dirCount > 1  );
2216
            return $base if ( $dirCount > 1  );
2178
        }
2217
        }
2179
        else
2218
        elsif ( -e $_ )
2180
        {
2219
        {
2181
            return $base;
2220
            return $base;
2182
        }
2221
        }
-
 
2222
 
-
 
2223
        # else its probably a dead symlink
2183
    }
2224
    }
2184
    return $base unless ( $dirCount == 1  );
2225
    return $base unless ( $dirCount == 1  );
2185
    $base = $list[0];
2226
    $base = $firstDir;
2186
    }
2227
    }
2187
}
2228
}
2188
 
2229
 
2189
 
2230
 
2190
#-------------------------------------------------------------------------------
2231
#-------------------------------------------------------------------------------
Line 2219... Line 2260...
2219
}
2260
}
2220
 
2261
 
2221
sub saneLabel
2262
sub saneLabel
2222
{
2263
{
2223
    my ($entry, $pkgname) = @_;
2264
    my ($entry, $pkgname) = @_;
-
 
2265
    my $me;
2224
    my $me = $versions{$entry}{vname};
2266
    $me = $versions{$entry}{vname};
2225
    $pkgname = $versions{$entry}{name} unless ( defined $pkgname );
2267
    $pkgname = $versions{$entry}{name} unless ( defined $pkgname );
2226
 
2268
 
2227
    Error ("Package does have a version string: pvid: $entry")
2269
    Error ("Package does have a version string: pvid: $entry")
2228
        unless ( defined $me );
2270
        unless ( defined $me );
2229
 
2271
 
Line 2798... Line 2840...
2798
        push @text, 'Bad Singletions : ' . $badSingletonCount;
2840
        push @text, 'Bad Singletions : ' . $badSingletonCount;
2799
        push @text, 'Deadwood entries : ' . $trimCount;
2841
        push @text, 'Deadwood entries : ' . $trimCount;
2800
        push @text, 'Walking Mode : Flat' if ($opt_flat);
2842
        push @text, 'Walking Mode : Flat' if ($opt_flat);
2801
        push @text, 'Pruned Mode : ' . $pruneModeString;
2843
        push @text, 'Pruned Mode : ' . $pruneModeString;
2802
        push @text, 'Pruned entries : ' . $pruneCount;
2844
        push @text, 'Pruned entries : ' . $pruneCount;
-
 
2845
        push @text, 'Recent entries : ' . $recentCount;
2803
 
2846
 
2804
        if ( @unknownProjects )
2847
        if ( @unknownProjects )
2805
        {
2848
        {
2806
            push @text, '|';
2849
            push @text, '|';
2807
            push @text, 'Unknown Projects';
2850
            push @text, 'Unknown Projects';
Line 2846... Line 2889...
2846
 
2889
 
2847
        my @attributes;
2890
        my @attributes;
2848
        push @attributes, "shape=record";
2891
        push @attributes, "shape=record";
2849
        push @attributes, "label=\"{$text}\"";
2892
        push @attributes, "label=\"{$text}\"";
2850
        push @attributes, "tooltip=\"$packageNames\"";
2893
        push @attributes, "tooltip=\"$packageNames\"";
2851
        push @attributes, "URL=\"" . $GBE_RM_URL . "/view_by_version.asp?pkg_id=$first_pkg_id" . "\"";
2894
        push (@attributes, "URL=\"" . $GBE_RM_URL . "/view_by_version.asp?pkg_id=$first_pkg_id" . "\"" )if $first_pkg_id;
2852
        push @attributes, "color=red";
2895
        push @attributes, "color=red";
2853
        my $attr = join( ' ', @attributes);
2896
        my $attr = join( ' ', @attributes);
2854
 
2897
 
2855
        my $tld_done = 'TitleBlock';
2898
        my $tld_done = 'TitleBlock';
2856
        print FH "$tld_done [$attr]\n";
2899
        print FH "$tld_done [$attr]\n";
Line 2871... Line 2914...
2871
        push @text, '|{Code';
2914
        push @text, '|{Code';
2872
        push @text, '|{N: Not Locked';
2915
        push @text, '|{N: Not Locked';
2873
        push @text, 'b: Bad Singleton';
2916
        push @text, 'b: Bad Singleton';
2874
        push @text, 'B: Bad VCS Tag';
2917
        push @text, 'B: Bad VCS Tag';
2875
        push @text, 'D: DeadWood';
2918
        push @text, 'D: DeadWood';
2876
        push @text, 'E: Essential Version';
2919
        push @text, 'E: Essential Release Version';
2877
        push @text, 'G: Glued into Version Tree';
2920
        push @text, 'G: Glued into Version Tree';
-
 
2921
        push @text, 'r: Recent version';
2878
        push @text, 'S: Splitpoint';
2922
        push @text, 'S: Splitpoint';
2879
        push @text, 't: Glued into Project Tree';
2923
        push @text, 't: Glued into Project Tree';
2880
        push @text, 'T: Tip version';
2924
        push @text, 'T: Tip version';
2881
        push @text, 'V: In SVN';
2925
        push @text, 'V: In SVN';
2882
        push @text, '+: In Subversion';
2926
        push @text, '+: In Subversion';
Line 2944... Line 2988...
2944
        $stateText .= 'B' if (exists $versions{$entry}{badVcsTag});
2988
        $stateText .= 'B' if (exists $versions{$entry}{badVcsTag});
2945
        $stateText .= 'G' if (exists $versions{$entry}{GluedIn});
2989
        $stateText .= 'G' if (exists $versions{$entry}{GluedIn});
2946
        $stateText .= 't' if (exists $versions{$entry}{MakeTree});
2990
        $stateText .= 't' if (exists $versions{$entry}{MakeTree});
2947
        $stateText .= 'E' if (exists $versions{$entry}{Essential});
2991
        $stateText .= 'E' if (exists $versions{$entry}{Essential});
2948
        $stateText .= 'D' if (exists $versions{$entry}{DeadWood});
2992
        $stateText .= 'D' if (exists $versions{$entry}{DeadWood});
-
 
2993
        $stateText .= 'r' if (exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
2949
        $stateText .= 'S' if (exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
2994
        $stateText .= 'S' if (exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
2950
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
2995
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
2951
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
2996
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
2952
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
2997
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
2953
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );
2998
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );