Subversion Repositories DevTools

Rev

Rev 297 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
267 dpurdie 1
########################################################################
2
# Copyright (C) 1998-2008 ERG Limited, All rights reserved
3
#
4
# Module name   : jats_svn.pl
5
# Module type   : Jats Utility
6
# Compiler(s)   : Perl
7
# Environment(s): Jats
8
#
9
# Description   : A script to perform a number of SVN utility functions
10
#                 The script will:
11
#                   Delete a package
12
#                   Create a package
13
#                   Import source to a package
14
#
15
#
16
#......................................................................#
17
 
18
require 5.006_001;
19
use strict;
20
use warnings;
21
use JatsError;
22
use JatsSvn qw(:All);
23
use JatsLocateFiles;
24
 
25
use Pod::Usage;                                 # required for help support
26
use Getopt::Long qw(:config require_order);     # Stop on non-option
27
use Cwd;
28
use File::Path;
29
use File::Copy;
30
use File::Basename;
31
use File::Compare;
32
 
33
my $VERSION = "1.0.0";                          # Update this
34
 
35
#
36
#   Options
37
#
38
my $opt_debug   = $ENV{'GBE_DEBUG'};            # Allow global debug
39
my $opt_verbose = $ENV{'GBE_VERBOSE'};          # Allow global verbose
40
my $opt_help = 0;
41
 
42
#
43
#   Globals
44
#
45
my $opr_done;                                   # User has done something
46
 
47
#-------------------------------------------------------------------------------
48
# Function        : Mainline Entry Point
49
#
50
# Description     :
51
#
52
# Inputs          :
53
#
54
my $result = GetOptions (
55
                "help:+"        => \$opt_help,              # flag, multiple use allowed
56
                "manual:3"      => \$opt_help,              # flag
57
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
58
 
59
                );
60
 
61
                #
62
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
63
                #
64
 
65
#
66
#   Process help and manual options
67
#
68
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
69
pod2usage(-verbose => 1) if ($opt_help == 2 );
70
pod2usage(-verbose => 2) if ($opt_help > 2);
71
 
72
#
73
#   Configure the error reporting process now that we have the user options
74
#
75
ErrorConfig( 'name'    =>'SVN',
76
             'verbose' => $opt_verbose,
77
            );
78
 
79
#
80
#   Reconfigure the optiosn parser to allow subcommands to parse options
81
#
82
Getopt::Long::Configure('permute');
83
 
84
#
85
#   Process command
86
#   First command line argument is a subversion command
87
#
88
my $cmd = shift @ARGV || "help";
89
CreatePackage()                        if ( $cmd =~ m/^create/ );
90
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
91
ImportPackage()                        if ( $cmd =~ m/^import/ );
92
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
93
 
94
pod2usage(-verbose => 0, -message => "No valid operations specified") unless ( $opr_done );
95
exit 0;
96
 
97
#-------------------------------------------------------------------------------
98
# Function        : SvnRepoCmd
99
#
100
# Description     : Execute a SVN command, where the first argument
101
#                   is a repository specifier
102
#
103
# Inputs          : $cmd
104
#                   $repo_url
105
#                   @opts
106
#
107
# Returns         : 
108
#
109
sub SvnRepoCmd
110
{
111
    my ( $cmd, $repo_url, @opts ) = @_;
112
    my $uref = NewSessionByUrl ( $repo_url );
113
 
114
    SvnUserCmd( $cmd,
115
            $uref->Full,
116
            @opts,
117
            { 'credentials' => 1 });
118
 
119
    $opr_done = 1;
120
}
121
 
122
#-------------------------------------------------------------------------------
123
# Function        : DeletePackage
124
#
125
# Description     : Delete a Package structure within a Repository
126
#                   Intended for test usage
127
#
128
# Inputs          : URL                 - Url to Repo + Package Base
129
#
130
# Returns         : 
131
#
132
sub DeletePackage
133
{
134
    #
135
    #   Parse more options
136
    #
137
    GetOptions (
138
                "help:+"        => \$opt_help,
139
                "manual:3"      => \$opt_help,
140
                ) || Error ("Invalid command line" );
141
 
142
    #
143
    #   Subcommand specific help
144
    #
145
    SubCommandHelp( $opt_help, "Delete a Package") if ($opt_help || $#ARGV < 0);
146
 
147
    #
148
    #   Sanity Tests
149
    #
150
    Message ("Delete Entire Package Tree" );
151
    Warning ("Too many arguments: @ARGV") if ( $#ARGV >= 1 );
152
 
153
    #
154
    #   Do all the hard work
155
    #       Create
156
    #       Import
157
    #       Label
158
    #
159
    my $uref = NewSessionByUrl ( $ARGV[0] );
160
    $uref->SvnValidatePackageRoot();
161
    $uref->SvnDelete (
162
                      'target'      => $uref->Full,
163
                      'comment'   => ['Deleted by user command','jats svn delete-package'],
164
                      'noerror'     => 0,
165
                      );
166
    $opr_done = 1;
167
}
168
 
169
#-------------------------------------------------------------------------------
170
# Function        : CreatePackage
171
#
172
# Description     : Create a Package structure within a Repository
173
#                   Optionally Import Data
174
#                   Optionally Tag the import
175
#                   Optionall Tag the import on a branch
176
#
177
# Inputs          : URL                 - Url to Repo + Package Base
178
#                   Options             - Command modifiers
179
#                       -import=path    - Import named directory
180
#                       -label=name     - Label the result
181
#                       -new            - Must be new package
182
#
183
# Returns         : 
184
#
185
sub CreatePackage
186
{
187
    my $opt_import;
188
    my $opt_tag;
189
    my $opt_branch;
190
    my $opt_trunk;
191
    my $opt_new;
192
    my $opt_label;
193
    my $opt_replace;
194
    my $pname;
195
    my $type;
196
 
197
 
198
    Message ("Create New Package Version" );
199
 
200
    #
201
    #   Parse more options
202
    #
203
    GetOptions (
204
                "help:+"        => \$opt_help,
205
                "manual:3"      => \$opt_help,
206
                "verbose:+"     => \$opt_verbose,
207
                "import=s"      => \$opt_import,
208
                "new"           => \$opt_new,
209
                "branch=s"      => \$opt_branch,
210
                "trunk"         => \$opt_trunk,
211
                "tag=s"         => \$opt_tag,
212
                "label=s"       => \$opt_label,
213
                "replace"       => \$opt_replace,
214
 
215
                ) || Error ("Invalid command line" );
216
 
217
    #
218
    #   Subcommand specific help
219
    #
220
    SubCommandHelp( $opt_help, "Create a Package Version") if ($opt_help || $#ARGV < 0);
221
 
222
    #
223
    #   Alter the error reporting paramters
224
    #
225
    ErrorConfig( 'verbose' => $opt_verbose );
226
 
227
    #
228
    #   Sanity Tests
229
    #
230
    my $count = 0;
231
    $count++ if ( $opt_trunk );
232
    $count++ if ( $opt_branch );
233
    $count++ if ( $opt_tag );
234
    Error ("Conflicting options: -trunk, -tag, -branch") if ( $count > 1 );
235
    Error ("Nothing imported to be labeled") if ( $count && !$opt_import );
236
    Error ("Import path does not exist: $opt_import") if ( $opt_import && ! -d $opt_import );
237
    Error ("Conflicting options: new and replace") if ( $opt_new && $opt_replace );
238
 
239
    ($type, $opt_label) = ('tags', $opt_tag)            if ( $opt_tag);
240
    ($type, $opt_label) = ('branches', $opt_branch)     if ( $opt_branch );
241
    ($type, $opt_label) = ('trunk', $opt_label)         if ( $opt_trunk);
242
 
243
    #
244
    #   Do all the hard work
245
    #       Create
246
    #       Import
247
    #       Label
248
    #
249
    my $uref = NewSessionByUrl ( $ARGV[0] );
250
    $uref->SvnCreatePackage (
251
                      'import'  => $opt_import,
252
                      'label'   => $opt_label,
253
                      'type'    => $type,
254
                      'new'     => $opt_new,
255
                      'replace' => $opt_replace,
256
                      );
257
    Message ("Repository Ref: " . $uref->RmRef);
258
    $opr_done = 1;
259
}
260
 
261
#-------------------------------------------------------------------------------
262
# Function        : ImportPackage
263
#
264
# Description     : Import a new version of a package
265
#                   Take great care to reuse file-versions that are already in
266
#                   the  package
267
#
268
#                   Intended to allow the imprtation of multiple
269
#                   versions of a package
270
#
271
# Inputs          : 
272
#
273
# Returns         : 
274
#
275
sub ImportPackage
276
{
277
    Message ("Import Package Version" );
278
 
279
    #
280
    #   Options
281
    #
282
    my $opt_package;
283
    my $opt_dir;
284
    my $opt_label;
285
    my $opt_replace = 0;
286
    my $opt_reuse;
287
    my $opt_workdir = "ImportDir";
288
 
289
    #
290
    #   Other globals
291
    #
292
    my $url_label;
293
 
294
    #
295
    #   Configuration options
296
    #
297
    my $result = GetOptions (
298
                    "help:+"        => \$opt_help,
299
                    "manual:3"      => \$opt_help,
300
                    "verbose:+"     => \$opt_verbose,
301
                    "package=s"     => \$opt_package,
302
                    "dir=s"         => \$opt_dir,
303
                    "label=s"       => \$opt_label,
304
                    "replace"       => \$opt_replace,
305
                    "reuse"         => \$opt_reuse,
306
                    "workspace"     => \$opt_workdir,
307
 
308
                    #
309
                    #   Update documentation at the end of the file
310
                    #
311
                    ) || Error ("Invalid command line" );
312
 
313
    #
314
    #   Insert defaults
315
    #   User can specify base package via -package or unoptions arguments
316
    #
317
    $opt_package = $ARGV[0] unless ( $opt_package );
318
 
319
    #
320
    #   Subcommand specific help
321
    #
322
    SubCommandHelp( $opt_help, "Import directory to a Package")
323
        if ($opt_help || ! $opt_package );
324
 
325
    #
326
    #   Alter the error reporting paramters
327
    #
328
    ErrorConfig( 'verbose' => $opt_verbose );
329
 
330
    #
331
    #   Configure the error reporting process now that we have the user options
332
    #
333
    Error ("No package URL specified") unless ( $opt_package );
334
    Error ("No base directory specified") unless ( $opt_dir );
335
    Error ("Invalid base directory: $opt_dir") unless ( -d $opt_dir );
336
 
337
    #
338
    #   Create an SVN session
339
    #
340
    my $svn = NewSessionByUrl ( $opt_package );
341
 
342
    #
343
    #   Ensure that the required label is available
344
    #
345
    if ( $opt_label )
346
    {
347
        $opt_label = SvnIsaSimpleLabel ($opt_label);
348
        $url_label = $svn->BranchName( $opt_label, 'tags' );
349
        $svn->SvnValidateTarget (
350
                        'target' => $url_label,
351
                        'available' => 1,
352
                        ) unless ( $opt_replace );
353
    }
354
 
355
    #
356
    #   Create a workspace based on the users package
357
    #   Allow the workspace to be reused to speed up multiple
358
    #   operations
359
    #
360
    unless ( $opt_reuse && -d $opt_workdir )
361
    {
362
        Message ("Creating Workspace");
363
        rmtree( $opt_workdir );
364
 
365
        $svn->SvnValidatePackageRoot ();
366
        #DebugDumpData( 'Svn', $svn );
367
        $svn->SvnValidateTarget (
368
                            'cmd'    => 'SvnImporter',
369
                            'target' => $svn->Full,
370
                            'require' => 1,
371
                            );
372
 
373
        $svn->SvnCo ( $svn->Full . '/trunk', $opt_workdir );
374
        Error ("Cannot locate the created Workspace")
375
            unless ( -d $opt_workdir );
376
    }
377
 
378
    #
379
    #   Determine differences between the two folders
380
    #       Create structures for each directory
381
    #
382
    Message ("Determine Files in packages");
383
 
384
    my $search = JatsLocateFiles->new("--Recurse=1",
385
                                       "--DirsToo",
386
                                       "--FilterOutRe=/\.svn/",
387
                                       "--FilterOutRe=/\.svn\$",
388
                                       );
389
    my @ws = $search->search($opt_workdir);
390
    my @dir = $search->search($opt_dir);
391
 
392
    #Information ("WS Results", @ws);
393
    #Information ("DIR Results", @dir);
394
 
395
    #
396
    #   Create a hash the Workspace and the User dir
397
    #   The key will be file names
398
    #
399
    my %ws;  map ( $ws{$_} = 1 , @ws );
400
    my %dir; map ( $dir{$_} = 1 , @dir );
401
 
402
    #
403
    #   Create a hash of common elements
404
    #   Removing then from the other two
405
    #
406
    my %common;
407
    foreach ( keys %ws )
408
    {
409
        next unless ( exists $dir{$_} );
410
        $common{$_} = 1;
411
        delete $ws{$_};
412
        delete $dir{$_};
413
    }
414
 
415
    #DebugDumpData( 'WS', \%ws );
416
    #DebugDumpData( 'DIR', \%dir );
417
    #DebugDumpData( 'COMMON', \%common );
418
 
419
    #
420
    #   Add New Files
421
    #   Won't add empty directories at this point
422
    #
423
    #   Process by sorted list
424
    #   This will ensure we process parent directories first
425
    #
426
    my @added = sort keys %dir;
427
 
428
    if ( @added )
429
    {
430
        foreach my $file ( @added  )
431
        {
432
            my $src = "$opt_dir/$file";
433
            my $target = "$opt_workdir/$file";
434
 
435
            if ( -d $src )
436
            {
437
                mkdir ( $target ) unless (-d $target);
438
            }
439
            else
440
            {
441
 
442
                my $path = dirname ( $target);
443
                mkdir ( $path ) unless (-d $path);
444
 
445
                Verbose ("Adding $file");
446
                unless (File::Copy::copy( $src, $target ))
447
                {
448
                    Error("Failed to transfer file [$file]: $!");
449
                }
450
            }
451
        }
452
 
453
        #
454
        #   Inform Subversion about the added files
455
        #
456
        Message ("Update the workspace: Added files");
457
        $svn->SvnCmd ( 'add'
458
                        , '--depth=empty'
459
                        , '--parents'
460
                        , map ("$opt_workdir/$_", @added),
461
                        { 'error' => 'Adding files to workspace' } );
462
    }
463
 
464
    #
465
    #   Remove files
466
    #   Don't really need to delete the files as the svn delete
467
    #   comamdn will do this too. Just do it anyway
468
    #
469
    my @rm_files = sort keys %ws;
470
    if ( @rm_files )
471
    {
472
        foreach my $file ( @rm_files  )
473
        {
474
            Verbose ("Removing $file");
475
            unlink "$opt_workdir/$file";
476
        }
477
 
478
        #
479
        #   Inform Subversion about the removed files
480
        #
481
        Message ("Update the workspace: Removed Files");
482
        $svn->SvnCmd ( 'delete', map ("$opt_workdir/$_", @rm_files ),
483
                        { 'error' => 'Deleting files from workspace' } );
484
    }
485
 
486
    #
487
    #   The common files may have changed
488
    #   Simply copy them all in and let subversion figure it out
489
    #
490
    foreach my $file ( sort keys %common  )
491
    {
492
        my $src = "$opt_dir/$file";
493
        my $target = "$opt_workdir/$file";
494
 
495
        next if ( -d $src );
496
        if ( File::Compare::compare ($src, $target) )
497
        {
498
            Verbose ("Transfer $file");
499
            unlink $target;
500
            unless (File::Copy::copy( $src, $target ))
501
            {
502
                Error("Failed to transfer file [$file]: $!",
503
                      "Src: $src",
504
                      "Tgt: $target");
505
            }
506
        }
507
    }
508
 
509
    #
510
    #   Commit the workspace
511
    #   This will go back onto the trunk
512
    #
513
    $svn = NewSessionByWS( $opt_workdir );
514
    $svn->SvnCi ('comment' => "Checkin by Svn Import" );
515
    Message ("Repository Ref: " . $svn->RmRef);
516
 
517
    #
518
    #   Label the result
519
    #   The workspace will have been updated, so we can use it as the base for
520
    #   the labeling process
521
    #
522
    if ( $opt_label )
523
    {
524
        $svn->SvnCopyWs (
525
                       target => $url_label,
526
                       'noswitch' => 1,
527
                       'replace' => $opt_replace,
528
                       'comment' => 'Created by Jats Svn Import',
529
                       );
530
        Message ("Repository Ref: " . $svn->RmRef);
531
    }
532
    $opr_done = 1;
533
}
534
 
535
#-------------------------------------------------------------------------------
536
# Function        : SubCommandHelp
537
#
538
# Description     : Provide help on a subcommand
539
#
540
# Inputs          : $help_level             - Help Level 1,2,3
541
#                   $topic                  - Topic Name
542
#
543
# Returns         : This function does not return
544
#
545
sub SubCommandHelp
546
{
547
    my ($help_level, $topic) = @_;
548
 
549
    #
550
    #   Spell out the section we want to display
551
    #
552
    #   Note:
553
    #   Due to bug in pod2usage cant use 'head1' by itself
554
    #   Each one needs a subsection.
555
    #
556
    my $help_re;
557
    my @sections;
558
    if ( $help_level <= 1 ) {
559
        @sections = qw( NAME SYNOPSIS );
560
    } elsif ( $help_level <= 2 ) {
561
        @sections = qw( NAME SYNOPSIS ARGUMENTS OPTIONS );
562
    } else {
563
        @sections = qw( NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION );
564
    };
565
 
566
    #
567
    #   Build up a topic list
568
    #
569
    $help_re .= $topic . '\/' . $_ . '|' foreach ( @sections );
570
 
571
    #
572
    #   Extract section from the POD
573
    #   Need trailling DUMMY to overcome BUG in pod2usage
574
    #
575
    pod2usage({-verbose => 99,
576
               -sections => $help_re . 'DUMMY'} );
577
}
578
 
579
 
580
 
581
#-------------------------------------------------------------------------------
582
#   Documentation
583
#   NOTE
584
#
585
#   Each subcommand MUST have
586
#   head1 section as used by the subcommand
587
#       This should be empty
588
#   head2 sections called
589
#       NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION
590
#
591
#=head1 xxxxxx
592
#=head2 NAME
593
#=head2 SYNOPSIS
594
#=head2 ARGUMENTS
595
#=head2 OPTIONS
596
#=head2 DESCRIPTION
597
#
598
 
599
=pod
600
 
601
=head1 NAME
602
 
603
jats svn - Miscellaneous SubVersion Operations
604
 
605
=head1 SYNOPSIS
606
 
607
jats svn [options] command [command options]
608
 
609
 Options:
610
    -help[=n]              - Help message, [n=1,2,3]
611
    -man                   - Full documentation [-help=3]
612
    -verbose[=n]           - Verbose command operation
613
 
614
 Common Command Options:
615
    All command support suboptions to provide command specific help
616
 
617
    -help[=n]              - Help message, [n=1,2,3]
618
    -man                   - Full documentation [-help=3]
619
 
620
 Commands are:
621
    ls URL                 - List Repo contents for URL
622
    delete-package URL     - Delete Package Subtree
623
    create URL             - Create a new package at URL
624
    import URL             - Import files to package at URL
625
 
626
 Use the command
627
    jats svn command -h
628
 for command specific help
629
 
630
 
631
=head1 OPTIONS
632
 
633
=over
634
 
635
=item B<-help[=n]>
636
 
637
Print a help message and exit. The level of help may be either 1, 2 or
638
3 for a full manual.
639
 
640
This option may be specified multiple times to increment the help level, or
641
the help level may be directly specified as a number.
642
 
643
=item B<-man>
644
 
645
This is the same as '-help=3'.
646
The complete help is produced in a man page format.
647
 
648
=item B<--verbose[=n]>
649
 
650
This option will increase the level of verbosity of the commands.
651
 
652
If an argument is provided, then it will be used to set the level, otherwise the
653
existing level will be incremented. This option may be specified multiple times.
654
 
655
=back
656
 
657
=head1 DESCRIPTION
658
 
659
This program provides a number of useful Subversion based operations.
660
 
661
=head1 List Repository
662
 
663
This command will take a URL and perform a 'svn' list operation. The URL will
664
be expanded to include the site specific repository.
665
 
666
=head1 Delete a Package
667
 
668
=head2 NAME
669
 
670
Delete a Package
671
 
672
=head2 SYNOPSIS
673
 
674
jats svn delete-package URL [options]
675
 
676
 Options:
677
    -help[=n]              - Help message, [n=1,2,3]
678
    -man                   - Full documentation [-help=3]
679
    -verbose[=n]           - Verbose command operation
680
 
681
=head2 ARGUMENTS
682
 
683
The command takes one argument: The URL of the desirecd package.
684
This may be be:
685
 
686
=over
687
 
688
=item * A full URL
689
 
690
Complete with protocol and path information.
691
 
692
=item * A simple URL
693
 
694
JATS will prepend the site-specific repository location to the user provided URL
695
 
696
=back
697
 
698
=head2 OPTIONS
699
 
700
This command has no significant options, other than the general help options.
701
 
702
=head2 DESCRIPTION
703
 
704
This command will delete a package from the repository. It will ensure
705
that the package is a valid package, before it is deleted.
706
 
707
The command is intended to be used by test scripts, rather than users.
708
 
709
=head1 Create a Package Version
710
 
711
=head2 NAME
712
 
713
Create a Package Version
714
 
715
=head2 SYNOPSIS
716
 
717
jats svn [options] create URL [command options]
718
 
719
 Options:
720
    -help[=n]               - Help message, [n=1,2,3]
721
    -man                    - Full documentation [-help=3]
722
    -verbose[=n]            - Verbose command operation
723
 
724
 Command Options
725
    -help[=n]               - Provide comand specific help
726
    -import=nnn             - Import directory tree
727
    -label=nnn              - Label it (trunk import only)
728
    -new                    - Package must not exist
729
    -replace                - Replace any existing versions
730
    -trunk                  - Import to trunk
731
    -tags=nnn               - Import to tags
732
    -branch=nnn             - Import to branches
733
 
734
=head2 ARGUMENTS
735
 
736
The command takes one argument: The URL of the desirecd package.
737
This may be be:
738
 
739
=over
740
 
741
=item * A full URL
742
 
743
Complete with protocol and path information.
744
 
745
=item * A simple URL
746
 
747
JATS will prepend the site-specific repository location to the user provided URL
748
 
749
=back
750
 
751
=head2 OPTIONS
752
 
753
=over
754
 
755
=item -help[=n]
756
 
757
Print a help message and exit. The level of help may be either 1, 2 or 3.
758
 
759
This option may be specified multiple times to increment the help level, or
760
the help level may be directly specified as a number.
761
 
762
=item -import=nnn
763
 
764
This option specifies the path of a subdirectory tree to import into the newly
765
created package. In not provided, then only a package skeleton will be created.
766
 
767
=item -label=nnn
768
 
769
This option specifes a label to place the imported source, if the source is
770
being imported to the 'trunk' of the package.
771
 
772
=item -new
773
 
774
This option specifies that the named package MUST not exist at all.
775
 
776
=item -replace
777
 
778
This option allows the program to replace any existing versions of the
779
imported source. It will allow the deletion of any existing trunk, trags or
780
branches.
781
 
782
=item -trunk
783
 
784
This option specifies that imported source will be placed on the trunk of the
785
package. This is the default mode of import.
786
 
787
The options -trunk, -tags and -branch are mutally exclusive.
788
 
789
=item -tags=nnn
790
 
791
This option specifies that imported source will be placed directly on the
792
named tag of ther package.
793
 
794
The options -trunk, -tags and -branch are mutally exclusive.
795
 
796
=item -branch=nnn
797
 
798
This option specifies that imported source will be placed directly on the
799
named branch of ther package.
800
 
801
The options -trunk, -tags and -branch are mutally exclusive.
802
 
803
=back
804
 
805
=head2 DESCRIPTION
806
 
807
This command will create a new package within a repository. It will ensure
808
that the package contains the three required subdirectories: trunk, tags and
809
branches.
810
 
811
The command will also ensure that packages are not placed at inappropriate
812
locations within the repository. It is not correct to place a package within
813
another package.
814
 
815
The command will, optionally, import a directory tree into the repository and,
816
optionally, label the package.
817
 
818
The package body may be imported to the 'trunk' or to a branch or a tag.
819
By default the data will be imported to the trunk and may be labled (tagged).
820
 
821
Options allow the targets to be deleletd if they exist or to ensure that they
822
are not present.
823
 
824
The command does not attempt to merge file versions within the repository. It
825
may result in multiple instances of a file within the repository. Use only for
826
simple imports.
827
 
828
=head1 Import directory to a Package
829
 
830
=head2 NAME
831
 
832
Import directory to a Package
833
 
834
=head2 SYNOPSIS
835
 
836
jats svn [options] import URL [command options]
837
 
838
 Options:
839
    -help[=n]               - Help message, [n=1,2,3]
840
    -man                    - Full documentation [-help=3]
841
    -verbose[=n]            - Verbose command operation
842
 
843
 Command Options
844
    -help[=n]               - Command specific help, [n=1,2,3]
845
    -verbose[=n]            - Verbose operation
846
    -package=name           - Name of source package
847
    -dir=path               - Path to new version
848
    -label                  - Label the result
849
    -replace                - Allow the label to be replaced
850
    -reuse                  - Reuse the import directory
851
    -workspace=path         - Path and name of alternate workspace
852
 
853
=head2 ARGUMENTS
854
 
855
The command takes one argument: The URL of the desirecd package.
856
This may be be:
857
 
858
=over
859
 
860
=item * A full URL
861
 
862
Complete with protocol and path information.
863
 
864
=item * A simple URL
865
 
866
JATS will prepend the site-specific repository location to the user provided URL
867
 
868
=back
869
 
870
=head2 OPTIONS
871
 
872
=over
873
 
874
=item -help[=n]
875
 
876
Print a help message and exit. The level of help may be either 1, 2 or 3.
877
 
878
This option may be specified multiple times to increment the help level, or
879
the help level may be directly specified as a number.
880
 
881
=item -verbose[=n]
882
 
883
This option will increase the level of verbosity of the utility.
884
 
885
If an argument is provided, then it will be used to set the level, otherwise the
886
existing level will be incremented. This option may be specified multiple times.
887
 
888
 
889
=item -package=name
890
 
891
This option is mandatory. It specifies the repository and package to be used as a
892
basis for the work.
893
 
894
=item -dir=path
895
 
896
This option is mandatory. It specifies the path to a local directory that
897
contains a version of the software to be checked in.
898
 
899
=item -label=name
900
 
901
The resulting software version will be labled with this tag, if it is provided.
902
 
903
=item -replace
904
 
905
This option, if provided, allows the label to be replaced.
906
 
907
=item -reuse
908
 
909
This option can be used to speed the creation of multiple versions in a scripted
910
environment. The option allows the utility to reuse the workspace if it exists
911
 
912
=item -workpspace=path
913
 
914
This option specifies an alternate workspace directory to create and use. The
915
default directory is "ImportDir" within the users current directory.
916
 
917
=back
918
 
919
=head2 DESCRIPTION
920
 
921
Import a new version of a package to the trunk of the package. The utility
922
will only import changed files so that file history is preserved within the
923
repository.
924
 
925
This utility is used import software from another version control system
926
The utility will:
927
 
928
=over
929
 
930
=item * Create a Work Space based on the current pakage version
931
 
932
The 'trunk' of the named package will be used as the baes for the workspace.
933
 
934
=item * Update files and directories
935
 
936
Determines the files and directories that have been added and deleted and
937
update the Workspace to reflect the new structure.
938
 
939
=item * Check in the new version
940
 
941
=item * Label the new version
942
 
943
=back
944
 
945
=cut
946