Subversion Repositories DevTools

Rev

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

Rev 363 Rev 369
Line 75... Line 75...
75
ErrorConfig( 'name'    =>'SVN',
75
ErrorConfig( 'name'    =>'SVN',
76
             'verbose' => $opt_verbose,
76
             'verbose' => $opt_verbose,
77
            );
77
            );
78
 
78
 
79
#
79
#
80
#   Reconfigure the optiosn parser to allow subcommands to parse options
80
#   Reconfigure the options parser to allow subcommands to parse options
81
#
81
#
82
Getopt::Long::Configure('permute');
82
Getopt::Long::Configure('permute');
83
 
83
 
84
#
84
#
85
#   Process command
85
#   Process command
Line 89... Line 89...
89
CreatePackage()                        if ( $cmd =~ m/^create/ );
89
CreatePackage()                        if ( $cmd =~ m/^create/ );
90
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
90
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
91
ImportPackage()                        if ( $cmd =~ m/^import/ );
91
ImportPackage()                        if ( $cmd =~ m/^import/ );
92
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
92
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
93
TestSvn()                              if ($cmd eq 'test');
93
TestSvn()                              if ($cmd eq 'test');
-
 
94
ShowPaths()                            if ( $cmd =~ m/^path/ );
-
 
95
ShowTag()                              if ( $cmd =~ m/^tag/ );
-
 
96
ShowUrl()                              if ( $cmd =~ m/^url/ );
94
 
97
 
95
pod2usage(-verbose => 0, -message => "No valid operations specified") unless ( $opr_done );
98
pod2usage(-verbose => 0, -message => "No valid operations specified") unless ( $opr_done );
96
exit 0;
99
exit 0;
97
 
100
 
98
#-------------------------------------------------------------------------------
101
#-------------------------------------------------------------------------------
-
 
102
# Function        : ShowPaths
-
 
103
#
-
 
104
# Description     : Show PATHS
-
 
105
#
-
 
106
# Inputs          : 
-
 
107
#
-
 
108
# Returns         : 
-
 
109
#
-
 
110
sub ShowPaths
-
 
111
{
-
 
112
    #
-
 
113
    #   Parse more options
-
 
114
    #
-
 
115
    GetOptions (
-
 
116
                "help:+"        => \$opt_help,
-
 
117
                "manual:3"      => \$opt_help,
-
 
118
                ) || Error ("Invalid command line" );
-
 
119
 
-
 
120
    #
-
 
121
    #   Subcommand specific help
-
 
122
    #
-
 
123
    SubCommandHelp( $opt_help, "Subversion Paths") if ($opt_help || $#ARGV >= 0);
-
 
124
 
-
 
125
    #
-
 
126
    #   Display known PATHS
-
 
127
    #
-
 
128
    my ( $pSVN_URLS, $pSVN_URLS_LIST) = SvnPaths();
-
 
129
    print ("Configured SubVersion Repository Paths\n");
-
 
130
    print sprintf("    %-20s %s\n", 'Tag', 'URL Prefix');
-
 
131
 
-
 
132
    foreach my $key ( @{$pSVN_URLS_LIST} )
-
 
133
    {
-
 
134
        print sprintf("    %-20s %s\n", $key || 'Default', $pSVN_URLS->{$key} );
-
 
135
    }
-
 
136
 
-
 
137
    $opr_done = 1;
-
 
138
}
-
 
139
 
-
 
140
#-------------------------------------------------------------------------------
-
 
141
# Function        : ShowTag
-
 
142
#
-
 
143
# Description     : Convert a URL into a TAG
-
 
144
#                   Convert the current workspace info into a TAG
-
 
145
#
-
 
146
# Inputs          : url                     - Url to convert (optional)
-
 
147
#                   Options
-
 
148
#                       -help[=n]           - Show help
-
 
149
#                       -man                - Show manual
-
 
150
#                       -url=url            - Convert URL
-
 
151
#                       -path=path          - Convert Workspace
-
 
152
#
-
 
153
# Returns         : Nothing
-
 
154
#
-
 
155
sub ShowTag
-
 
156
{
-
 
157
    my $opt_path;
-
 
158
    my $opt_url;
-
 
159
 
-
 
160
    #
-
 
161
    #   Parse more options
-
 
162
    #
-
 
163
    GetOptions (
-
 
164
                "help:+"        => \$opt_help,
-
 
165
                "manual:3"      => \$opt_help,
-
 
166
                "path:s"        => \$opt_path,
-
 
167
                "url:s"         => \$opt_url,
-
 
168
                ) || Error ("Invalid command line" );
-
 
169
 
-
 
170
    #
-
 
171
    #   Subcommand specific help
-
 
172
    #
-
 
173
    SubCommandHelp( $opt_help, "Url to Tag") if ($opt_help);
-
 
174
 
-
 
175
    #
-
 
176
    #   Bare argument is a URL
-
 
177
    #   If no arguments provided assume a path of the current directory
-
 
178
    #
-
 
179
    $opt_url = shift (@ARGV) if ( $#ARGV == 0 );
-
 
180
    $opt_path = '.' unless ( defined $opt_path || defined $opt_url );
-
 
181
 
-
 
182
    #
-
 
183
    #   Sanity Tests
-
 
184
    #
-
 
185
    Error ("Cannot specify both a URL and a PATH")
-
 
186
            if ( defined $opt_url && defined $opt_path );
-
 
187
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
-
 
188
 
-
 
189
    #   Do all the hard work
-
 
190
    #
-
 
191
    my $uref;
-
 
192
    if ( $opt_url )
-
 
193
    {
-
 
194
        $uref = NewSessionByUrl ( $opt_url );
-
 
195
        $uref->CalcRmReference($uref->Full());
-
 
196
    }
-
 
197
    else
-
 
198
    {
-
 
199
        $uref = NewSessionByWS($opt_path, 0, 1);
-
 
200
        my $ws_root = $uref->SvnLocateWsRoot(1);
-
 
201
        $uref->CalcRmReference($uref->FullWs());
-
 
202
    }
-
 
203
 
-
 
204
    Message ("Tag is: " . $uref->RmRef() );
-
 
205
    $opr_done = 1;
-
 
206
}
-
 
207
#-------------------------------------------------------------------------------
-
 
208
# Function        : ShowUrl
-
 
209
#
-
 
210
# Description     : Convert a TAG into a URL
-
 
211
#                   Show the current workspace URL
-
 
212
#
-
 
213
# Inputs          : tag                     - Tag to convert (optional)
-
 
214
#                   Options
-
 
215
#                       -help[=n]           - Show help
-
 
216
#                       -man                - Show manual
-
 
217
#                       -tag=tag            - Convert TAG
-
 
218
#                       -path=path          - Convert Workspace
-
 
219
#
-
 
220
# Returns         : Nothing
-
 
221
#
-
 
222
sub ShowUrl
-
 
223
{
-
 
224
    my $opt_path;
-
 
225
    my $opt_tag;
-
 
226
 
-
 
227
    #
-
 
228
    #   Parse more options
-
 
229
    #
-
 
230
    GetOptions (
-
 
231
                "help:+"        => \$opt_help,
-
 
232
                "manual:3"      => \$opt_help,
-
 
233
                "path:s"        => \$opt_path,
-
 
234
                "tag:s"         => \$opt_tag,
-
 
235
                ) || Error ("Invalid command line" );
-
 
236
 
-
 
237
    #
-
 
238
    #   Subcommand specific help
-
 
239
    #
-
 
240
    SubCommandHelp( $opt_help, "Tag to Url") if ($opt_help);
-
 
241
 
-
 
242
    #
-
 
243
    #   Bare argument is a TAG
-
 
244
    #   If no arguments provided assume a path of the current directory
-
 
245
    #
-
 
246
    $opt_tag = shift (@ARGV) if ( $#ARGV == 0 );
-
 
247
    $opt_path = '.' unless ( defined $opt_path || defined $opt_tag );
-
 
248
 
-
 
249
    #
-
 
250
    #   Sanity Tests
-
 
251
    #
-
 
252
    Error ("Cannot specify both a TAG and a PATH")
-
 
253
            if ( defined $opt_tag && defined $opt_path );
-
 
254
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
-
 
255
 
-
 
256
    #   Do all the hard work
-
 
257
    #
-
 
258
    my $uref;
-
 
259
    my $url;
-
 
260
    if ( $opt_tag )
-
 
261
    {
-
 
262
        $url = SvnPath2Url($opt_tag);
-
 
263
    }
-
 
264
    else
-
 
265
    {
-
 
266
        $uref = NewSessionByWS($opt_path, 0, 1);
-
 
267
        my $ws_root = $uref->SvnLocateWsRoot(1);
-
 
268
        $url = $uref->FullWsRev();
-
 
269
    }
-
 
270
 
-
 
271
    Message ("Url: $url");
-
 
272
    $opr_done = 1;
-
 
273
}
-
 
274
 
-
 
275
#-------------------------------------------------------------------------------
99
# Function        : TestSvn
276
# Function        : TestSvn
100
#
277
#
101
# Description     : Test access to subversion
278
# Description     : Test access to subversion
102
#
279
#
103
# Inputs          : None
280
# Inputs          : None
Line 251... Line 428...
251
    #   Subcommand specific help
428
    #   Subcommand specific help
252
    #
429
    #
253
    SubCommandHelp( $opt_help, "Create a Package Version") if ($opt_help || $#ARGV < 0);
430
    SubCommandHelp( $opt_help, "Create a Package Version") if ($opt_help || $#ARGV < 0);
254
                
431
                
255
    #
432
    #
256
    #   Alter the error reporting paramters
433
    #   Alter the error reporting parameters
257
    #
434
    #
258
    ErrorConfig( 'verbose' => $opt_verbose );
435
    ErrorConfig( 'verbose' => $opt_verbose );
259
 
436
 
260
    #
437
    #
261
    #   Sanity Tests
438
    #   Sanity Tests
Line 296... Line 473...
296
#
473
#
297
# Description     : Import a new version of a package
474
# Description     : Import a new version of a package
298
#                   Take great care to reuse file-versions that are already in
475
#                   Take great care to reuse file-versions that are already in
299
#                   the  package
476
#                   the  package
300
#
477
#
301
#                   Intended to allow the imprtation of multiple
478
#                   Intended to allow the importation of multiple
302
#                   versions of a package
479
#                   versions of a package
303
#
480
#
304
# Inputs          : 
481
# Inputs          : 
305
#
482
#
306
# Returns         : 
483
# Returns         : 
Line 356... Line 533...
356
    #
533
    #
357
    SubCommandHelp( $opt_help, "Import directory to a Package")
534
    SubCommandHelp( $opt_help, "Import directory to a Package")
358
        if ($opt_help || ! $opt_package );
535
        if ($opt_help || ! $opt_package );
359
 
536
 
360
    #
537
    #
361
    #   Alter the error reporting paramters
538
    #   Alter the error reporting parameters
362
    #
539
    #
363
    ErrorConfig( 'verbose' => $opt_verbose );
540
    ErrorConfig( 'verbose' => $opt_verbose );
364
 
541
 
365
    #
542
    #
366
    #   Configure the error reporting process now that we have the user options
543
    #   Configure the error reporting process now that we have the user options
Line 517... Line 694...
517
    }
694
    }
518
 
695
 
519
    #
696
    #
520
    #   Remove files
697
    #   Remove files
521
    #   Don't really need to delete the files as the svn delete
698
    #   Don't really need to delete the files as the svn delete
522
    #   comamdn will do this too. Just do it anyway
699
    #   command will do this too. Just do it anyway
523
    #
700
    #
524
    my @rm_files = sort keys %ws;
701
    my @rm_files = sort keys %ws;
525
    if ( @rm_files )
702
    if ( @rm_files )
526
    {
703
    {
527
        foreach my $file ( @rm_files  )
704
        foreach my $file ( @rm_files  )
Line 685... Line 862...
685
    -help[=n]              - Help message, [n=1,2,3]
862
    -help[=n]              - Help message, [n=1,2,3]
686
    -man                   - Full documentation [-help=3]
863
    -man                   - Full documentation [-help=3]
687
 
864
 
688
 Commands are:
865
 Commands are:
689
    test                   - Test access to subversion
866
    test                   - Test access to subversion
-
 
867
    paths                  - Display Subversion tag to URL conversions
690
    ls URL                 - List Repo contents for URL
868
    ls URL                 - List Repo contents for URL
-
 
869
    tag [URL]              - Convert URL or Path to a Release Manager Tag
-
 
870
    url [TAG]              - Convert TAG or Path to a Subversion URL
691
    delete-package URL     - Delete Package Subtree
871
    delete-package URL     - Delete Package Subtree
692
    create URL             - Create a new package at URL
872
    create URL             - Create a new package at URL
693
    import URL             - Import files to package at URL
873
    import URL             - Import files to package at URL
694
 
874
 
695
 Use the command
875
 Use the command
Line 740... Line 920...
740
=head2 DESCRIPTION
920
=head2 DESCRIPTION
741
 
921
 
742
This command will ensure that the subversion command line utility can be
922
This command will ensure that the subversion command line utility can be
743
located. The command will report the version of the svn client found.
923
located. The command will report the version of the svn client found.
744
 
924
 
-
 
925
=head1 Subversion Paths
-
 
926
 
-
 
927
=head2 NAME
-
 
928
 
-
 
929
Subversion Paths
-
 
930
 
-
 
931
=head2 SYNOPSIS
-
 
932
 
-
 
933
    jats svn paths
-
 
934
 
-
 
935
=head2 DESCRIPTION
-
 
936
 
-
 
937
This command will display the base Tags and associated URLs that are used by
-
 
938
JATS to convert a 'Subversion Tag' into a full URLs that will be used to access
-
 
939
a physical repository.
-
 
940
 
-
 
941
The 'Tags' configuration is site-specific.
-
 
942
 
745
=head1 List Repository
943
=head1 List Repository
746
 
944
 
747
=head2 NAME
945
=head2 NAME
748
 
946
 
749
List Repository
947
List Repository
Line 755... Line 953...
755
=head2 DESCRIPTION
953
=head2 DESCRIPTION
756
 
954
 
757
This command will take a URL and perform a 'svn' list operation. The URL will
955
This command will take a URL and perform a 'svn' list operation. The URL will
758
be expanded to include the site specific repository.
956
be expanded to include the site specific repository.
759
 
957
 
-
 
958
=head1 Url to Tag
-
 
959
 
-
 
960
=head2 NAME
-
 
961
 
-
 
962
Url to Tag
-
 
963
 
-
 
964
=head2 SYNOPSIS
-
 
965
 
-
 
966
    jats svn tag [Option] [tag]
-
 
967
 
-
 
968
 Options:
-
 
969
    -help[=n]              - Help message, [n=1,2,3]
-
 
970
    -man                   - Full documentation [-help=3]
-
 
971
    -path=path             - Convert specified path
-
 
972
    -url=url               - Convert specified URL
-
 
973
 
-
 
974
=head2 DESCRIPTION
-
 
975
 
-
 
976
This command will convert a URL or a PATH to a Subversion Tag that can
-
 
977
be used within the remainder of the build system. If no PATH or URL is provided,
-
 
978
then the command uses a path of the current directory.
-
 
979
 
-
 
980
The command will convert either a PATH or a URL. It will not do both.
-
 
981
 
-
 
982
The command will use the configured Subversion URL prefixes to create the Tag.
-
 
983
 
-
 
984
If a PATH is to be converted, then the PATH must address a Subversion workspace.
-
 
985
The conversion will return a Tag to the root of the Workspace and Peg it to
-
 
986
the last committed version. The command will not determine if the workspace
-
 
987
contains modified files.
-
 
988
 
-
 
989
If a URL is to be converted, then the resultant value should be used with
-
 
990
caution. The result is only as good as the provided URL and may not address
-
 
991
the root of a package.
-
 
992
 
-
 
993
=head1 Tag to Url
-
 
994
 
-
 
995
=head2 NAME
-
 
996
 
-
 
997
Tag to Url
-
 
998
 
-
 
999
=head2 SYNOPSIS
-
 
1000
 
-
 
1001
    jats svn url [Option] [url]
-
 
1002
 
-
 
1003
 Options:
-
 
1004
    -help[=n]              - Help message, [n=1,2,3]
-
 
1005
    -man                   - Full documentation [-help=3]
-
 
1006
    -path=path             - Convert specified path
-
 
1007
    -url=url               - Convert specified URL
-
 
1008
 
-
 
1009
=head2 DESCRIPTION
-
 
1010
 
-
 
1011
This command will convert a TAG or a PATH to a full URL that can be used
-
 
1012
directly by Subversion. If no PATH or TAG is provided, then the command uses a
-
 
1013
path of the current directory.
-
 
1014
 
-
 
1015
The command will convert either a TAG or a URL. It will not do both.
-
 
1016
 
-
 
1017
The command will use the configured Subversion URL prefixes to expand the TAG.
-
 
1018
 
-
 
1019
If a PATH is to be converted, then the PATH must address a Subversion workspace.
-
 
1020
The conversion will return a URL to the root of the Workspace and Peg it to
-
 
1021
the last committed version. The command will not determine if the workspace
-
 
1022
contains modified files.
-
 
1023
 
-
 
1024
If a TAG is to be converted, then the resultant value should be used with
-
 
1025
caution. The result is only as good as the provided URL and may not address
-
 
1026
the root of a package.
-
 
1027
 
760
=head1 Delete a Package
1028
=head1 Delete a Package
761
 
1029
 
762
=head2 NAME
1030
=head2 NAME
763
 
1031
 
764
Delete a Package
1032
Delete a Package