Subversion Repositories DevTools

Rev

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

Rev 1344 Rev 1345
Line 72... Line 72...
72
#
72
#
73
# Description     : Create a workspace
73
# Description     : Create a workspace
74
#                   Can be used to extract files, without creating the
74
#                   Can be used to extract files, without creating the
75
#                   subversion control files.
75
#                   subversion control files.
76
#
76
#
77
# Inputs          : $self               - Instance data
77
# Inputs          : $self                   - Instance data
78
#                   $RepoPath           - Within the repository
78
#                   $RepoPath               - Within the repository
79
#                   $Path               - Local path
79
#                   $Path                   - Local path
80
#                   Options             - Options
80
#                   Options                 - Options
81
#                           --Export    - Export Only
81
#                           --Export        - Export Only
82
#                           --NoPrint   - Don't print files exported
82
#                           --NoPrint       - Don't print files exported
83
#                           --Force     - Force export to overwrite
83
#                           --Force         - Force export to overwrite
-
 
84
#                           --PreText=aa    - Display before operation
84
#
85
#
85
# Returns         : Nothing
86
# Returns         : Nothing
86
#
87
#
87
sub SvnCo
88
sub SvnCo
88
{
89
{
89
    my ($self, $RepoPath, $path, @opts) = @_;
90
    my ($self, $RepoPath, $path, @opts) = @_;
90
    my $export = grep (/^--Export/, @opts );
-
 
91
    my $force  = grep (/^--Force/, @opts );
-
 
92
    $self->{PRINTDATA} = ! grep (/^--NoPrint/, @opts );
-
 
93
    Debug ("SvnCo", $RepoPath, $path);
91
    Debug ("SvnCo", $RepoPath, $path);
94
 
92
 
-
 
93
    my $cmd = 'checkout';
-
 
94
    my $force;
-
 
95
    my $text = 'Extracting';
-
 
96
    my $print = 1;
-
 
97
    
-
 
98
    foreach  ( @opts )
-
 
99
    {
-
 
100
        if ( m~^--Export~ ) {
-
 
101
            $cmd = 'export';
-
 
102
        } elsif ( m~^--Force~ ) {
-
 
103
            $force = 1;
-
 
104
        } elsif ( m~^--PreText=(.+)~ ) {
-
 
105
            $text = $1;
-
 
106
        } elsif ( m~^--NoPrint~ ) {
-
 
107
            $print = 0;
-
 
108
        } else {
-
 
109
            Error ("ScnCo: Unknown option: $_");
-
 
110
        }
-
 
111
    }
-
 
112
    $self->{CoText} = $text;
-
 
113
    $self->{PRINTDATA} = $print;
-
 
114
 
95
    #
115
    #
96
    #   Ensure that the output path does not exist
116
    #   Ensure that the output path does not exist
97
    #   Do not allow the user to create a local work space
117
    #   Do not allow the user to create a local work space
98
    #   where one already exists
118
    #   where one already exists
99
    #
119
    #
Line 101... Line 121...
101
    Error ("SvnCo: Target path already exists", "Path: " . $path ) if ( ! $force && -e $path  );
121
    Error ("SvnCo: Target path already exists", "Path: " . $path ) if ( ! $force && -e $path  );
102
 
122
 
103
    #
123
    #
104
    #   Build up the command line
124
    #   Build up the command line
105
    #
125
    #
106
    my @args = $export ? 'export' : 'checkout';
126
    my @args = $cmd;
107
    push @args, qw( --ignore-externals );
127
    push @args, qw( --ignore-externals );
108
    push @args, qw( --force ) if ( $force );
128
    push @args, qw( --force ) if ( $force );
109
    push @args, $RepoPath, $path;
129
    push @args, $RepoPath, $path;
110
 
130
 
111
    my @co_list;
131
    my @co_list;
Line 154... Line 174...
154
        if ( $self->{PRINTDATA} )
174
        if ( $self->{PRINTDATA} )
155
        {
175
        {
156
            #
176
            #
157
            #   Pretty display for user
177
            #   Pretty display for user
158
            #
178
            #
159
            Information1 ("Extracting: $data");
179
            Information1 ( $self->{CoText} . ': ' . $data);
160
        }
180
        }
161
 
181
 
162
        if (  $data =~ m~((/)(tags|branches|trunk)(/|$))~ )
182
        if (  $data =~ m~((/)(tags|branches|trunk)(/|$))~ )
163
        {
183
        {
164
            my $bad_dir = $1;
184
            my $bad_dir = $1;