Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
311 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;
379 dpurdie 24
use JatsProperties;
311 dpurdie 25
 
379 dpurdie 26
 
311 dpurdie 27
use Pod::Usage;                                 # required for help support
28
use Getopt::Long qw(:config require_order);     # Stop on non-option
29
use Cwd;
30
use File::Path;
31
use File::Copy;
32
use File::Basename;
33
use File::Compare;
34
 
35
my $VERSION = "1.0.0";                          # Update this
36
 
37
#
38
#   Options
39
#
40
my $opt_debug   = $ENV{'GBE_DEBUG'};            # Allow global debug
41
my $opt_verbose = $ENV{'GBE_VERBOSE'};          # Allow global verbose
42
my $opt_help = 0;
43
 
44
#
45
#   Globals
46
#
47
my $opr_done;                                   # User has done something
48
 
49
#-------------------------------------------------------------------------------
50
# Function        : Mainline Entry Point
51
#
52
# Description     :
53
#
54
# Inputs          :
55
#
56
my $result = GetOptions (
57
                "help:+"        => \$opt_help,              # flag, multiple use allowed
58
                "manual:3"      => \$opt_help,              # flag
59
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
60
 
61
                );
62
 
63
                #
64
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
65
                #
66
 
67
#
68
#   Process help and manual options
69
#
70
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
71
pod2usage(-verbose => 1) if ($opt_help == 2 );
72
pod2usage(-verbose => 2) if ($opt_help > 2);
73
 
74
#
75
#   Configure the error reporting process now that we have the user options
76
#
77
ErrorConfig( 'name'    =>'SVN',
78
             'verbose' => $opt_verbose,
79
            );
80
 
81
#
369 dpurdie 82
#   Reconfigure the options parser to allow subcommands to parse options
311 dpurdie 83
#
84
Getopt::Long::Configure('permute');
85
 
86
#
87
#   Process command
88
#   First command line argument is a subversion command
89
#
90
my $cmd = shift @ARGV || "help";
91
CreatePackage()                        if ( $cmd =~ m/^create/ );
385 dpurdie 92
DeleteBranch()                         if ( $cmd =~ m/^delete-branch/ );
311 dpurdie 93
DeletePackage()                        if ( $cmd =~ m/^delete-package/ );
94
ImportPackage()                        if ( $cmd =~ m/^import/ );
95
SvnRepoCmd($cmd, @ARGV)                if ( $cmd eq 'ls' );
363 dpurdie 96
TestSvn()                              if ($cmd eq 'test');
369 dpurdie 97
ShowPaths()                            if ( $cmd =~ m/^path/ );
98
ShowTag()                              if ( $cmd =~ m/^tag/ );
99
ShowUrl()                              if ( $cmd =~ m/^url/ );
311 dpurdie 100
 
101
pod2usage(-verbose => 0, -message => "No valid operations specified") unless ( $opr_done );
102
exit 0;
103
 
104
#-------------------------------------------------------------------------------
369 dpurdie 105
# Function        : ShowPaths
106
#
107
# Description     : Show PATHS
108
#
109
# Inputs          : 
110
#
111
# Returns         : 
112
#
113
sub ShowPaths
114
{
115
    #
116
    #   Parse more options
117
    #
118
    GetOptions (
119
                "help:+"        => \$opt_help,
120
                "manual:3"      => \$opt_help,
121
                ) || Error ("Invalid command line" );
122
 
123
    #
124
    #   Subcommand specific help
125
    #
126
    SubCommandHelp( $opt_help, "Subversion Paths") if ($opt_help || $#ARGV >= 0);
127
 
128
    #
129
    #   Display known PATHS
130
    #
131
    my ( $pSVN_URLS, $pSVN_URLS_LIST) = SvnPaths();
132
    print ("Configured SubVersion Repository Paths\n");
133
    print sprintf("    %-20s %s\n", 'Tag', 'URL Prefix');
134
 
135
    foreach my $key ( @{$pSVN_URLS_LIST} )
136
    {
137
        print sprintf("    %-20s %s\n", $key || 'Default', $pSVN_URLS->{$key} );
138
    }
139
 
140
    $opr_done = 1;
141
}
142
 
143
#-------------------------------------------------------------------------------
144
# Function        : ShowTag
145
#
146
# Description     : Convert a URL into a TAG
147
#                   Convert the current workspace info into a TAG
148
#
149
# Inputs          : url                     - Url to convert (optional)
150
#                   Options
151
#                       -help[=n]           - Show help
152
#                       -man                - Show manual
153
#                       -url=url            - Convert URL
154
#                       -path=path          - Convert Workspace
155
#
156
# Returns         : Nothing
157
#
158
sub ShowTag
159
{
160
    my $opt_path;
161
    my $opt_url;
162
 
163
    #
164
    #   Parse more options
165
    #
166
    GetOptions (
167
                "help:+"        => \$opt_help,
168
                "manual:3"      => \$opt_help,
169
                "path:s"        => \$opt_path,
170
                "url:s"         => \$opt_url,
171
                ) || Error ("Invalid command line" );
172
 
173
    #
174
    #   Subcommand specific help
175
    #
176
    SubCommandHelp( $opt_help, "Url to Tag") if ($opt_help);
177
 
178
    #
179
    #   Bare argument is a URL
180
    #   If no arguments provided assume a path of the current directory
181
    #
182
    $opt_url = shift (@ARGV) if ( $#ARGV == 0 );
183
    $opt_path = '.' unless ( defined $opt_path || defined $opt_url );
184
 
185
    #
186
    #   Sanity Tests
187
    #
188
    Error ("Cannot specify both a URL and a PATH")
189
            if ( defined $opt_url && defined $opt_path );
190
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
191
 
192
    #   Do all the hard work
193
    #
194
    my $uref;
195
    if ( $opt_url )
196
    {
197
        $uref = NewSessionByUrl ( $opt_url );
198
        $uref->CalcRmReference($uref->Full());
199
    }
200
    else
201
    {
202
        $uref = NewSessionByWS($opt_path, 0, 1);
203
        my $ws_root = $uref->SvnLocateWsRoot(1);
204
        $uref->CalcRmReference($uref->FullWs());
205
    }
206
 
207
    Message ("Tag is: " . $uref->RmRef() );
208
    $opr_done = 1;
209
}
210
#-------------------------------------------------------------------------------
211
# Function        : ShowUrl
212
#
213
# Description     : Convert a TAG into a URL
214
#                   Show the current workspace URL
215
#
216
# Inputs          : tag                     - Tag to convert (optional)
217
#                   Options
218
#                       -help[=n]           - Show help
219
#                       -man                - Show manual
220
#                       -tag=tag            - Convert TAG
221
#                       -path=path          - Convert Workspace
222
#
223
# Returns         : Nothing
224
#
225
sub ShowUrl
226
{
227
    my $opt_path;
228
    my $opt_tag;
229
 
230
    #
231
    #   Parse more options
232
    #
233
    GetOptions (
234
                "help:+"        => \$opt_help,
235
                "manual:3"      => \$opt_help,
236
                "path:s"        => \$opt_path,
237
                "tag:s"         => \$opt_tag,
238
                ) || Error ("Invalid command line" );
239
 
240
    #
241
    #   Subcommand specific help
242
    #
243
    SubCommandHelp( $opt_help, "Tag to Url") if ($opt_help);
244
 
245
    #
246
    #   Bare argument is a TAG
247
    #   If no arguments provided assume a path of the current directory
248
    #
249
    $opt_tag = shift (@ARGV) if ( $#ARGV == 0 );
250
    $opt_path = '.' unless ( defined $opt_path || defined $opt_tag );
251
 
252
    #
253
    #   Sanity Tests
254
    #
255
    Error ("Cannot specify both a TAG and a PATH")
256
            if ( defined $opt_tag && defined $opt_path );
257
    Warning ("Too many arguments") if ( $#ARGV >= 0 );
258
 
259
    #   Do all the hard work
260
    #
261
    my $uref;
262
    my $url;
263
    if ( $opt_tag )
264
    {
265
        $url = SvnPath2Url($opt_tag);
266
    }
267
    else
268
    {
269
        $uref = NewSessionByWS($opt_path, 0, 1);
270
        my $ws_root = $uref->SvnLocateWsRoot(1);
271
        $url = $uref->FullWsRev();
272
    }
273
 
274
    Message ("Url: $url");
275
    $opr_done = 1;
276
}
277
 
278
#-------------------------------------------------------------------------------
363 dpurdie 279
# Function        : TestSvn
280
#
281
# Description     : Test access to subversion
282
#
283
# Inputs          : None
284
#
285
# Returns         :
286
#
287
sub TestSvn
288
{
289
    #
290
    #   Parse more options
291
    #
292
    GetOptions (
293
                "help:+"        => \$opt_help,
294
                "manual:3"      => \$opt_help,
295
                ) || Error ("Invalid command line" );
296
 
297
    #
298
    #   Subcommand specific help
299
    #
300
    SubCommandHelp( $opt_help, "Test Subversion") if ($opt_help || $#ARGV >= 0);
301
 
302
    SvnUserCmd( '--version');
303
    $opr_done = 1;
304
}
305
 
306
 
307
#-------------------------------------------------------------------------------
311 dpurdie 308
# Function        : SvnRepoCmd
309
#
310
# Description     : Execute a SVN command, where the first argument
311
#                   is a repository specifier
312
#
313
# Inputs          : $cmd
314
#                   $repo_url
315
#                   @opts
316
#
317
# Returns         : 
318
#
319
sub SvnRepoCmd
320
{
321
    my ( $cmd, $repo_url, @opts ) = @_;
322
    my $uref = NewSessionByUrl ( $repo_url );
323
 
324
    SvnUserCmd( $cmd,
325
            $uref->Full,
326
            @opts,
327
            { 'credentials' => 1 });
328
 
329
    $opr_done = 1;
330
}
331
 
332
#-------------------------------------------------------------------------------
333
# Function        : DeletePackage
334
#
335
# Description     : Delete a Package structure within a Repository
336
#                   Intended for test usage
337
#
338
# Inputs          : URL                 - Url to Repo + Package Base
339
#
340
# Returns         : 
341
#
342
sub DeletePackage
343
{
379 dpurdie 344
    my $opt_error = 0;
311 dpurdie 345
    #
346
    #   Parse more options
347
    #
348
    GetOptions (
349
                "help:+"        => \$opt_help,
350
                "manual:3"      => \$opt_help,
379 dpurdie 351
                "error!"       => \$opt_error,
311 dpurdie 352
                ) || Error ("Invalid command line" );
353
 
354
    #
355
    #   Subcommand specific help
356
    #
357
    SubCommandHelp( $opt_help, "Delete a Package") if ($opt_help || $#ARGV < 0);
358
 
359
    #
360
    #   Sanity Tests
361
    #
362
    Message ("Delete Entire Package Tree" );
363
    Warning ("Too many arguments: @ARGV") if ( $#ARGV >= 1 );
364
 
365
    #
366
    #   Do all the hard work
367
    #       Create
368
    #       Import
369
    #       Label
370
    #
371
    my $uref = NewSessionByUrl ( $ARGV[0] );
379 dpurdie 372
    $uref->SvnValidatePackageRoot(!$opt_error);
311 dpurdie 373
    $uref->SvnDelete (
374
                      'target'      => $uref->Full,
385 dpurdie 375
                      'comment'   => [$uref->Path().": Delete Package",'Deleted by user command: jats svn delete-package'],
379 dpurdie 376
                      'noerror'   => !$opt_error,
311 dpurdie 377
                      );
378
    $opr_done = 1;
379
}
380
 
381
#-------------------------------------------------------------------------------
382
# Function        : CreatePackage
383
#
384
# Description     : Create a Package structure within a Repository
385
#                   Optionally Import Data
386
#                   Optionally Tag the import
387
#                   Optionally Tag the import on a branch
388
#
389
# Inputs          : URL                 - Url to Repo + Package Base
390
#                   Options             - Command modifiers
391
#                       -import=path    - Import named directory
392
#                       -label=name     - Label the result
393
#                       -tag=name       - Import to Tag Only
394
#                       -branch=name    - Import to Branch only
395
#                       -new            - Must be new package
396
#                       -replace        - Replace existing
397
#
398
# Returns         : 
399
#
400
sub CreatePackage
401
{
402
    my $opt_import;
403
    my $opt_tag;
404
    my $opt_branch;
405
    my $opt_trunk;
406
    my $opt_new;
407
    my $opt_label;
408
    my $opt_replace;
409
    my $pname;
410
    my $type;
385 dpurdie 411
    my $opt_author;
412
    my $opt_date;
311 dpurdie 413
 
414
 
415
    Message ("Create New Package Version" );
416
 
417
    #
418
    #   Parse more options
419
    #
420
    GetOptions (
421
                "help:+"        => \$opt_help,
422
                "manual:3"      => \$opt_help,
423
                "verbose:+"     => \$opt_verbose,
424
                "import=s"      => \$opt_import,
425
                "new"           => \$opt_new,
426
                "branch=s"      => \$opt_branch,
427
                "trunk"         => \$opt_trunk,
428
                "tag=s"         => \$opt_tag,
429
                "label=s"       => \$opt_label,
430
                "replace"       => \$opt_replace,
385 dpurdie 431
                'author=s'      => \$opt_author,
432
                'date=s'        => \$opt_date,
311 dpurdie 433
 
434
                ) || Error ("Invalid command line" );
435
 
436
    #
437
    #   Subcommand specific help
438
    #
439
    SubCommandHelp( $opt_help, "Create a Package Version") if ($opt_help || $#ARGV < 0);
440
 
441
    #
369 dpurdie 442
    #   Alter the error reporting parameters
311 dpurdie 443
    #
444
    ErrorConfig( 'verbose' => $opt_verbose );
445
 
446
    #
447
    #   Sanity Tests
448
    #
449
    my $count = 0;
450
    $count++ if ( $opt_trunk );
451
    $count++ if ( $opt_branch );
452
    $count++ if ( $opt_tag );
453
    Error ("Conflicting options: -trunk, -tag, -branch") if ( $count > 1 );
454
    Error ("Nothing imported to be labeled") if ( $count && !$opt_import );
455
    Error ("Import path does not exist: $opt_import") if ( $opt_import && ! -d $opt_import );
456
    Error ("Conflicting options: new and replace") if ( $opt_new && $opt_replace );
385 dpurdie 457
    Error ("Too many command line arguments") if ( exists $ARGV[1] );
311 dpurdie 458
 
459
    ($type, $opt_label) = ('tags', $opt_tag)            if ( $opt_tag);
460
    ($type, $opt_label) = ('branches', $opt_branch)     if ( $opt_branch );
461
    ($type, $opt_label) = ('trunk', $opt_label)         if ( $opt_trunk);
462
 
463
    #
464
    #   Do all the hard work
465
    #       Create
466
    #       Import
467
    #       Label
468
    #
469
    my $uref = NewSessionByUrl ( $ARGV[0] );
470
    $uref->SvnCreatePackage (
471
                      'import'  => $opt_import,
472
                      'label'   => $opt_label,
473
                      'type'    => $type,
474
                      'new'     => $opt_new,
475
                      'replace' => $opt_replace,
476
                      );
385 dpurdie 477
    #
478
    # Report RmPath as using a pegged version of a new package is a bit silly
479
    #
480
    Message ("Repository Ref: " . $uref->RmPath);
481
    $uref->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
482
    $uref->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
311 dpurdie 483
    $opr_done = 1;
484
}
485
 
486
#-------------------------------------------------------------------------------
487
# Function        : ImportPackage
488
#
489
# Description     : Import a new version of a package
490
#                   Take great care to reuse file-versions that are already in
491
#                   the  package
492
#
369 dpurdie 493
#                   Intended to allow the importation of multiple
311 dpurdie 494
#                   versions of a package
495
#
496
# Inputs          : 
497
#
498
# Returns         : 
499
#
500
sub ImportPackage
501
{
502
    Message ("Import Package Version" );
503
 
504
    #
505
    #   Options
506
    #
507
    my $opt_package;
508
    my $opt_dir;
509
    my $opt_label;
510
    my $opt_replace = 0;
511
    my $opt_reuse;
512
    my $opt_workdir = "SvnImportDir";
513
    my $opt_delete = 1;
379 dpurdie 514
    my $opt_author;
515
    my $opt_date;
516
    my $opt_log = '';
517
    my $opt_branch;
518
    my $opt_datafile;
311 dpurdie 519
 
520
    #
521
    #   Other globals
522
    #
523
    my $url_label;
379 dpurdie 524
    my $url_branch;
311 dpurdie 525
 
526
    #
527
    #   Configuration options
528
    #
529
    my $result = GetOptions (
379 dpurdie 530
                    'help:+'        => \$opt_help,
531
                    'manual:3'      => \$opt_help,
532
                    'verbose:+'     => \$opt_verbose,
533
                    'package=s'     => \$opt_package,
534
                    'dir=s'         => \$opt_dir,
535
                    'label=s'       => \$opt_label,
536
                    'branch=s'      => \$opt_branch,
537
                    'replace'       => \$opt_replace,
538
                    'reuse'         => \$opt_reuse,
539
                    'workspace=s'   => \$opt_workdir,
540
                    'delete!'       => \$opt_delete,
541
                    'author=s'      => \$opt_author,
542
                    'date=s'        => \$opt_date,
543
                    'log=s'         => \$opt_log,
544
                    'datafile=s'    => \$opt_datafile,
311 dpurdie 545
 
546
                    #
547
                    #   Update documentation at the end of the file
548
                    #
549
                    ) || Error ("Invalid command line" );
550
 
551
    #
552
    #   Insert defaults
341 dpurdie 553
    #   User can specify base package via -package or a non-options argument
311 dpurdie 554
    #
555
    $opt_package = $ARGV[0] unless ( $opt_package );
379 dpurdie 556
    unlink $opt_datafile if ( defined $opt_datafile );
311 dpurdie 557
 
558
    #
559
    #   Subcommand specific help
560
    #
561
    SubCommandHelp( $opt_help, "Import directory to a Package")
562
        if ($opt_help || ! $opt_package );
563
 
564
    #
369 dpurdie 565
    #   Alter the error reporting parameters
311 dpurdie 566
    #
567
    ErrorConfig( 'verbose' => $opt_verbose );
568
 
569
    #
570
    #   Configure the error reporting process now that we have the user options
571
    #
572
    Error ("No package URL specified") unless ( $opt_package );
573
    Error ("No base directory specified") unless ( $opt_dir );
574
    Error ("Invalid base directory: $opt_dir") unless ( -d $opt_dir );
575
 
576
    #
577
    #   Create an SVN session
578
    #
579
    my $svn = NewSessionByUrl ( $opt_package );
580
 
581
    #
582
    #   Ensure that the required label is available
583
    #
584
    if ( $opt_label )
585
    {
586
        $opt_label = SvnIsaSimpleLabel ($opt_label);
587
        $url_label = $svn->BranchName( $opt_label, 'tags' );
588
        $svn->SvnValidateTarget (
589
                        'target' => $url_label,
590
                        'available' => 1,
591
                        ) unless ( $opt_replace );
592
    }
593
 
594
    #
379 dpurdie 595
    #   Validate the required branch
596
    #   It will be created if it doesn't exist
597
    #
598
    if ( $opt_branch )
599
    {
600
        $opt_branch = SvnIsaSimpleLabel($opt_branch);
601
        $url_branch = $svn->BranchName( $opt_branch, 'branches' );
385 dpurdie 602
        my $rv = $svn->SvnValidateTarget (
603
                        'cmd'    => 'SvnImporter. Create branch',
379 dpurdie 604
                        'target' => $url_branch,
605
                        'create' => 1,
606
                        );
385 dpurdie 607
        if ( $rv == 2 )
608
        {
609
            $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
610
            $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
611
        }
379 dpurdie 612
    }
613
 
614
    #
311 dpurdie 615
    #   Create a workspace based on the users package
616
    #   Allow the workspace to be reused to speed up multiple
617
    #   operations
618
    #
619
    unless ( $opt_reuse && -d $opt_workdir )
620
    {
621
        Message ("Creating Workspace");
622
        rmtree( $opt_workdir );
623
 
624
        $svn->SvnValidatePackageRoot ();
625
        #DebugDumpData( 'Svn', $svn );
626
        $svn->SvnValidateTarget (
627
                            'cmd'    => 'SvnImporter',
628
                            'target' => $svn->Full,
629
                            'require' => 1,
630
                            );
631
 
379 dpurdie 632
        my $url_co = $opt_branch ? $url_branch : $svn->Full . '/trunk';
633
        $svn->SvnCo ( $url_co, $opt_workdir );
311 dpurdie 634
        Error ("Cannot locate the created Workspace")
635
            unless ( -d $opt_workdir );
636
    }
637
    else
638
    {
639
        Message ("Reusing Workspace");
640
    }
641
 
642
    #
643
    #   Determine differences between the two folders
644
    #       Create structures for each directory
645
    #
646
    Message ("Determine Files in packages");
647
 
648
    my $search = JatsLocateFiles->new("--Recurse=1",
649
                                       "--DirsToo",
650
                                       "--FilterOutRe=/\.svn/",
651
                                       "--FilterOutRe=/\.svn\$",
652
                                       "--FilterOutRe=^/${opt_workdir}\$",
653
                                       "--FilterOutRe=^/${opt_workdir}/",
654
                                       );
655
    my @ws = $search->search($opt_workdir);
656
    my @dir = $search->search($opt_dir);
657
 
658
    #Information ("WS Results", @ws);
659
    #Information ("DIR Results", @dir);
660
 
661
    #
662
    #   Create a hash the Workspace and the User dir
663
    #   The key will be file names
664
    #
665
    my %ws;  map ( $ws{$_} = 1 , @ws );
666
    my %dir; map ( $dir{$_} = 1 , @dir );
667
 
668
    #
669
    #   Create a hash of common elements
670
    #   Removing then from the other two
671
    #
672
    my %common;
673
    foreach ( keys %ws )
674
    {
675
        next unless ( exists $dir{$_} );
676
        $common{$_} = 1;
677
        delete $ws{$_};
678
        delete $dir{$_};
679
    }
680
 
681
    #DebugDumpData( 'WS', \%ws );
682
    #DebugDumpData( 'DIR', \%dir );
683
    #DebugDumpData( 'COMMON', \%common );
684
 
685
    #
379 dpurdie 686
    #   Need to consider the case where a file has been replaced with a directory
687
    #   and visa-versa. Delete files and directories first.
688
    #
689
    #
690
    #   Remove files
691
    #   Sort in reverse. This will ensure that we process directory
692
    #   contents before directories
693
    #
694
    my @rm_files = reverse sort keys %ws;
695
    if ( @rm_files )
696
    {
697
        foreach my $file ( @rm_files  )
698
        {
699
            Verbose ("Removing $file");
700
            unlink "$opt_workdir/$file";
701
        }
702
 
703
        #
704
        #   Inform Subversion about the removed files
705
        #
706
        my $base = 0;
707
        my $num = $#rm_files;
708
        Message ("Update the workspace: Removed " . ($num + 1) . " Files");
709
 
710
        while ( $base <= $num )
711
        {
712
            my $end = $base + 200;
713
            $end = $num if ( $end > $num );
714
 
715
            $svn->SvnCmd ( 'delete', map ("$opt_workdir/$_@", @rm_files[$base .. $end] ),
716
                            { 'error' => 'Deleting files from workspace' } );
717
 
718
            $base = $end + 1;
719
        }
720
    }
721
 
722
    #
311 dpurdie 723
    #   Add New Files
724
    #   Won't add empty directories at this point
725
    #
726
    #   Process by sorted list
727
    #   This will ensure we process parent directories first
728
    #
729
    my @added = sort keys %dir;
730
    if ( @added )
731
    {
732
        foreach my $file ( @added  )
733
        {
734
            my $src = "$opt_dir/$file";
735
            my $target = "$opt_workdir/$file";
736
 
737
            if ( -d $src )
738
            {
379 dpurdie 739
                Verbose ("Adding directory: $file");
311 dpurdie 740
                mkdir ( $target ) unless (-d $target);
741
            }
742
            else
743
            {
744
 
745
                my $path = dirname ( $target);
746
                mkdir ( $path ) unless (-d $path);
747
 
748
                Verbose ("Adding $file");
749
                unless (File::Copy::copy( $src, $target ))
750
                {
751
                    Error("Failed to transfer file [$file]: $!");
752
                }
753
            }
754
        }
755
 
756
        #
757
        #   Inform Subversion about the added files
758
        #   The command line does have a finite length, so add them 200 at a
759
        #   time.
760
        #
761
 
762
        my $base = 0;
763
        my $num = $#added;
379 dpurdie 764
        Message ("Update the workspace: Added " . (1 + $num) . " files");
311 dpurdie 765
 
766
        while ( $base <= $num )
767
        {
768
            my $end = $base + 200;
769
            $end = $num if ( $end > $num );
770
 
771
            $svn->SvnCmd ( 'add'
772
                            , '--depth=empty'
773
                            , '--parents'
379 dpurdie 774
                            , map ("$opt_workdir/$_@", @added[$base .. $end] ),
311 dpurdie 775
                            { 'error' => 'Adding files to workspace' } );
776
 
777
            $base = $end + 1;
778
        }
779
    }
780
 
781
    #
782
    #   The common files may have changed
783
    #   Simply copy them all in and let subversion figure it out
784
    #
785
    foreach my $file ( sort keys %common  )
786
    {
787
        my $src = "$opt_dir/$file";
788
        my $target = "$opt_workdir/$file";
789
 
790
        next if ( -d $src );
791
        if ( File::Compare::compare ($src, $target) )
792
        {
793
            Verbose ("Transfer $file");
794
            unlink $target;
795
            unless (File::Copy::copy( $src, $target ))
796
            {
797
                Error("Failed to transfer file [$file]: $!",
798
                      "Src: $src",
799
                      "Tgt: $target");
800
            }
801
        }
802
    }
803
 
804
    #
805
    #   Commit the workspace
806
    #   This will go back onto the trunk
807
    #
808
    $svn = NewSessionByWS( $opt_workdir );
379 dpurdie 809
    my $pkgPath = $svn->Path();
810
    my $ciComment = "$pkgPath: Checkin by Svn Import";
811
    $ciComment .= "\n" . $opt_log if ( $opt_log );
812
    $ciComment =~ s~\r\n~\n~g;
813
    $svn->SvnCi ('comment' => $ciComment, 'allowSame' => 1 );
381 dpurdie 814
    Message ("Repository Ref: " . $svn->RmRef) unless( $opt_label );
379 dpurdie 815
    $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
816
    $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
311 dpurdie 817
 
818
    #
819
    #   Label the result
820
    #   The workspace will have been updated, so we can use it as the base for
821
    #   the labeling process
822
    #
823
    if ( $opt_label )
824
    {
825
        $svn->SvnCopyWs (
826
                       target => $url_label,
827
                       'noswitch' => 1,
828
                       'replace' => $opt_replace,
379 dpurdie 829
                       'comment' => "$pkgPath: Tagged by Jats Svn Import",
311 dpurdie 830
                       );
831
        Message ("Repository Ref: " . $svn->RmRef);
379 dpurdie 832
        $svn->setRepoProperty('svn:author', $opt_author) if (defined ($opt_author));
833
        $svn->setRepoProperty('svn:date', $opt_date) if (defined ($opt_date));
311 dpurdie 834
    }
835
 
836
    #
837
    #   Clean up
838
    #
839
    if ( $opt_delete && ! $opt_reuse )
840
    {
841
        Message ("Delete Workspace");
842
        rmtree( $opt_workdir );
843
    }
379 dpurdie 844
 
845
    #
846
    #   Automation data transfer
847
    #
848
    if ( defined $opt_datafile )
849
    {
850
        my $data = JatsProperties::New();
851
 
852
        $data->setProperty('Command'        , 'ImportPackage');
853
        $data->setProperty('Label'          , $opt_label);
854
        $data->setProperty('subversion.tag' , $svn->RmRef);
855
 
856
        $data->Dump('InfoFile') if ($opt_verbose);
857
        $data->store( $opt_datafile );
858
    }
859
 
311 dpurdie 860
    $opr_done = 1;
861
}
862
 
863
#-------------------------------------------------------------------------------
385 dpurdie 864
# Function        : DeleteBranch
865
#
866
# Description     : Delete the branch that a workspace is based upon
867
#
868
# Inputs          : 
869
#
870
# Returns         : 
871
#
872
sub DeleteBranch
873
{
874
    my $opt_path;
875
    my $opt_error = 0;
876
    #
877
    #   Parse more options
878
    #
879
    GetOptions (
880
                "help:+"        => \$opt_help,
881
                "manual:3"      => \$opt_help,
882
                "path:s"        => \$opt_path,
883
                ) || Error ("Invalid command line" );
884
 
885
    #
886
    #   Subcommand specific help
887
    #
888
    SubCommandHelp( $opt_help, "Delete Branch") if ($opt_help);
889
 
890
    #
891
    #   Sanity Tests
892
    #
893
    Message ("Delete Workspace Branch" );
894
    Error ("Too many arguments: @ARGV") if ( $#ARGV >= 0 );
895
 
896
    #
897
    #   Do all the hard work
898
    #
899
    $opt_path = '.' unless ( defined $opt_path );
900
    my $uref = NewSessionByWS($opt_path, 0, 1);
901
    my $ws_root = $uref->SvnLocateWsRoot(1);
902
    my $ws_url = $uref->FullWs();
903
 
904
    #
905
    #   Must be a branch
906
    #
907
    Error ("Workspace is not based on a branch")
908
        unless ( $ws_url =~ m ~/branches/~ );
909
 
910
    Message ("Deleting: " . $uref->{WSURL} );
911
    $uref->SvnDelete (
912
                      'target'    => $ws_url,
913
                      'comment'   => [$uref->Path().": Delete Branch",'Deleted by user command: jats svn delete-branch'],
914
                      );
915
    $opr_done = 1;
916
}
917
 
918
 
919
#-------------------------------------------------------------------------------
311 dpurdie 920
# Function        : SubCommandHelp
921
#
922
# Description     : Provide help on a subcommand
923
#
924
# Inputs          : $help_level             - Help Level 1,2,3
925
#                   $topic                  - Topic Name
926
#
927
# Returns         : This function does not return
928
#
929
sub SubCommandHelp
930
{
931
    my ($help_level, $topic) = @_;
932
    my @sections;
933
    #
934
    #   Spell out the section we want to display
935
    #
936
    #   Note:
937
    #   Due to bug in pod2usage can't use 'head1' by itself
938
    #   Each one needs a subsection.
939
    #
940
    push @sections, qw( NAME SYNOPSIS ) ;
941
    push @sections, qw( ARGUMENTS OPTIONS ) if ( $help_level > 1 );
942
    push @sections, qw( DESCRIPTION )       if ( $help_level > 2 );
943
 
944
    #
945
    #   Extract section from the POD
946
    #
947
    pod2usage({-verbose => 99,
948
               -noperldoc => 1,
949
               -sections => $topic . '/' . join('|', @sections) } );
950
}
951
 
952
 
953
 
954
#-------------------------------------------------------------------------------
955
#   Documentation
956
#   NOTE
957
#
958
#   Each subcommand MUST have
959
#   head1 section as used by the subcommand
960
#       This should be empty, as the contents will NOT be displayed
961
#   head2 sections called
962
#       NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION
963
#
964
#=head1 xxxxxx
965
#=head2 NAME
966
#=head2 SYNOPSIS
967
#=head2 ARGUMENTS
968
#=head2 OPTIONS
969
#=head2 DESCRIPTION
970
#
971
 
972
=pod
973
 
361 dpurdie 974
=for htmltoc    GENERAL::Subversion::
975
 
311 dpurdie 976
=head1 NAME
977
 
978
jats svn - Miscellaneous SubVersion Operations
979
 
980
=head1 SYNOPSIS
981
 
982
jats svn [options] command [command options]
983
 
984
 Options:
985
    -help[=n]              - Help message, [n=1,2,3]
986
    -man                   - Full documentation [-help=3]
987
    -verbose[=n]           - Verbose command operation
988
 
989
 Common Command Options:
990
    All command support suboptions to provide command specific help
991
 
992
    -help[=n]              - Help message, [n=1,2,3]
993
    -man                   - Full documentation [-help=3]
994
 
995
 Commands are:
363 dpurdie 996
    test                   - Test access to subversion
369 dpurdie 997
    paths                  - Display Subversion tag to URL conversions
311 dpurdie 998
    ls URL                 - List Repo contents for URL
369 dpurdie 999
    tag [URL]              - Convert URL or Path to a Release Manager Tag
1000
    url [TAG]              - Convert TAG or Path to a Subversion URL
311 dpurdie 1001
    delete-package URL     - Delete Package Subtree
385 dpurdie 1002
    delete-branch          - Delete a Development Branch
311 dpurdie 1003
    create URL             - Create a new package at URL
1004
    import URL             - Import files to package at URL
1005
 
1006
 Use the command
1007
    jats svn command -h
1008
 for command specific help
1009
 
1010
 
1011
=head1 OPTIONS
1012
 
1013
=over
1014
 
1015
=item B<-help[=n]>
1016
 
1017
Print a help message and exit. The level of help may be either 1, 2 or
1018
3 for a full manual.
1019
 
1020
This option may be specified multiple times to increment the help level, or
1021
the help level may be directly specified as a number.
1022
 
1023
=item B<-man>
1024
 
1025
This is the same as '-help=3'.
1026
The complete help is produced in a man page format.
1027
 
1028
=item B<--verbose[=n]>
1029
 
1030
This option will increase the level of verbosity of the commands.
1031
 
1032
If an argument is provided, then it will be used to set the level, otherwise the
1033
existing level will be incremented. This option may be specified multiple times.
1034
 
1035
=back
1036
 
1037
=head1 DESCRIPTION
1038
 
1039
This program provides a number of useful Subversion based operations.
1040
 
363 dpurdie 1041
=head1 Test Subversion
1042
 
1043
=head2 NAME
1044
 
1045
Test Subversion
1046
 
1047
=head2 SYNOPSIS
1048
 
1049
    jats svn test
1050
 
1051
=head2 DESCRIPTION
1052
 
1053
This command will ensure that the subversion command line utility can be
1054
located. The command will report the version of the svn client found.
1055
 
369 dpurdie 1056
=head1 Subversion Paths
1057
 
1058
=head2 NAME
1059
 
1060
Subversion Paths
1061
 
1062
=head2 SYNOPSIS
1063
 
1064
    jats svn paths
1065
 
1066
=head2 DESCRIPTION
1067
 
1068
This command will display the base Tags and associated URLs that are used by
1069
JATS to convert a 'Subversion Tag' into a full URLs that will be used to access
1070
a physical repository.
1071
 
1072
The 'Tags' configuration is site-specific.
1073
 
311 dpurdie 1074
=head1 List Repository
1075
 
363 dpurdie 1076
=head2 NAME
1077
 
1078
List Repository
1079
 
1080
=head2 SYNOPSIS
1081
 
1082
    jats svn ls <URL>
1083
 
1084
=head2 DESCRIPTION
1085
 
311 dpurdie 1086
This command will take a URL and perform a 'svn' list operation. The URL will
1087
be expanded to include the site specific repository.
1088
 
369 dpurdie 1089
=head1 Url to Tag
1090
 
1091
=head2 NAME
1092
 
1093
Url to Tag
1094
 
1095
=head2 SYNOPSIS
1096
 
1097
    jats svn tag [Option] [tag]
1098
 
1099
 Options:
1100
    -help[=n]              - Help message, [n=1,2,3]
1101
    -man                   - Full documentation [-help=3]
1102
    -path=path             - Convert specified path
1103
    -url=url               - Convert specified URL
1104
 
1105
=head2 DESCRIPTION
1106
 
1107
This command will convert a URL or a PATH to a Subversion Tag that can
1108
be used within the remainder of the build system. If no PATH or URL is provided,
1109
then the command uses a path of the current directory.
1110
 
1111
The command will convert either a PATH or a URL. It will not do both.
1112
 
1113
The command will use the configured Subversion URL prefixes to create the Tag.
1114
 
1115
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1116
The conversion will return a Tag to the root of the Workspace and Peg it to
1117
the last committed version. The command will not determine if the workspace
1118
contains modified files.
1119
 
1120
If a URL is to be converted, then the resultant value should be used with
1121
caution. The result is only as good as the provided URL and may not address
1122
the root of a package.
1123
 
1124
=head1 Tag to Url
1125
 
1126
=head2 NAME
1127
 
1128
Tag to Url
1129
 
1130
=head2 SYNOPSIS
1131
 
1132
    jats svn url [Option] [url]
1133
 
1134
 Options:
1135
    -help[=n]              - Help message, [n=1,2,3]
1136
    -man                   - Full documentation [-help=3]
1137
    -path=path             - Convert specified path
1138
    -url=url               - Convert specified URL
1139
 
1140
=head2 DESCRIPTION
1141
 
1142
This command will convert a TAG or a PATH to a full URL that can be used
1143
directly by Subversion. If no PATH or TAG is provided, then the command uses a
1144
path of the current directory.
1145
 
1146
The command will convert either a TAG or a URL. It will not do both.
1147
 
1148
The command will use the configured Subversion URL prefixes to expand the TAG.
1149
 
1150
If a PATH is to be converted, then the PATH must address a Subversion workspace.
1151
The conversion will return a URL to the root of the Workspace and Peg it to
1152
the last committed version. The command will not determine if the workspace
1153
contains modified files.
1154
 
1155
If a TAG is to be converted, then the resultant value should be used with
1156
caution. The result is only as good as the provided URL and may not address
1157
the root of a package.
1158
 
311 dpurdie 1159
=head1 Delete a Package
1160
 
1161
=head2 NAME
1162
 
1163
Delete a Package
1164
 
1165
=head2 SYNOPSIS
1166
 
1167
jats svn delete-package URL [options]
1168
 
1169
 Options:
1170
    -help[=n]              - Help message, [n=1,2,3]
1171
    -man                   - Full documentation [-help=3]
1172
    -verbose[=n]           - Verbose command operation
1173
 
1174
=head2 ARGUMENTS
1175
 
1176
The command takes one argument: The URL of the desired package.
1177
This may be be:
1178
 
1179
=over
1180
 
1181
=item * A full URL
1182
 
1183
Complete with protocol and path information.
1184
 
1185
=item * A simple URL
1186
 
1187
JATS will prepend the site-specific repository location to the user provided URL
1188
 
1189
=back
1190
 
1191
=head2 OPTIONS
1192
 
1193
This command has no significant options, other than the general help options.
1194
 
1195
=head2 DESCRIPTION
1196
 
1197
This command will delete a package from the repository. It will ensure
1198
that the package is a valid package, before it is deleted.
1199
 
1200
The command is intended to be used by test scripts, rather than users.
1201
 
385 dpurdie 1202
=head1 Delete Branch
1203
 
1204
=head2 NAME
1205
 
1206
Delete the Workspace Branch
1207
 
1208
=head2 SYNOPSIS
1209
 
1210
jats svn delete-branch [options]
1211
 
1212
 Options:
1213
    -help[=n]              - Help message, [n=1,2,3]
1214
    -man                   - Full documentation [-help=3]
1215
    -verbose[=n]           - Verbose command operation
1216
    -path=path             - Target workspace
1217
 
1218
=head2 ARGUMENTS
1219
 
1220
The command takes no arguments.
1221
 
1222
=head2 OPTIONS
1223
 
1224
=over
1225
 
1226
=item B<-path=path>
1227
 
1228
This options specifies the path of the target workspace. If not provided the
1229
command will use the current directory.
1230
 
1231
=back
1232
 
1233
=head2 DESCRIPTION
1234
 
1235
This command will delete the branch associated with the workspace in the
1236
specified path. It is intended to simplify the deletion of Private or
1237
Development branches.
1238
 
1239
If the workspace is not linked to a 'branch' then the command will fail.
1240
 
311 dpurdie 1241
=head1 Create a Package Version
1242
 
1243
=head2 NAME
1244
 
1245
Create a Package Version
1246
 
1247
=head2 SYNOPSIS
1248
 
1249
jats svn [options] create URL [command options]
1250
 
1251
 Options:
1252
    -help[=n]               - Help message, [n=1,2,3]
1253
    -man                    - Full documentation [-help=3]
1254
    -verbose[=n]            - Verbose command operation
1255
 
1256
 Command Options
1257
    -help[=n]               - Provide command specific help
1258
    -import=nnn             - Import directory tree
1259
    -label=nnn              - Label it (trunk import only)
1260
    -new                    - Package must not exist
1261
    -replace                - Replace any existing versions
1262
    -trunk                  - Import to trunk
1263
    -tags=nnn               - Import to tags
1264
    -branch=nnn             - Import to branches
1265
 
1266
=head2 ARGUMENTS
1267
 
1268
The command takes one argument: The URL of the desired package.
1269
This may be be:
1270
 
1271
=over
1272
 
1273
=item * A full URL
1274
 
1275
Complete with protocol and path information.
1276
 
1277
=item * A simple URL
1278
 
1279
JATS will prepend the site-specific repository location to the user provided URL
1280
 
1281
=back
1282
 
1283
=head2 OPTIONS
1284
 
1285
=over
1286
 
1287
=item -help[=n]
1288
 
1289
Print a help message and exit. The level of help may be either 1, 2 or 3.
1290
 
1291
This option may be specified multiple times to increment the help level, or
1292
the help level may be directly specified as a number.
1293
 
1294
=item -import=nnn
1295
 
1296
This option specifies the path of a subdirectory tree to import into the newly
1297
created package. In not provided, then only a package skeleton will be created.
1298
 
1299
=item -label=nnn
1300
 
1301
This option specifies a label to place the imported source, if the source is
1302
being imported to the 'trunk' of the package.
1303
 
1304
=item -new
1305
 
1306
This option specifies that the named package MUST not exist at all.
1307
 
1308
=item -replace
1309
 
1310
This option allows the program to replace any existing versions of the
1311
imported source. It will allow the deletion of any existing trunk, tags or
1312
branches.
1313
 
1314
=item -trunk
1315
 
1316
This option specifies that imported source will be placed on the trunk of the
1317
package. This is the default mode of import.
1318
 
1319
The options -trunk, -tags and -branch are mutually exclusive.
1320
 
1321
=item -tags=nnn
1322
 
1323
This option specifies that imported source will be placed directly on the
1324
named tag of the package.
1325
 
1326
The options -trunk, -tags and -branch are mutually exclusive.
1327
 
1328
=item -branch=nnn
1329
 
1330
This option specifies that imported source will be placed directly on the
1331
named branch of the package.
1332
 
1333
The options -trunk, -tags and -branch are mutually exclusive.
1334
 
1335
=back
1336
 
1337
=head2 DESCRIPTION
1338
 
1339
This command will create a new package within a repository. It will ensure
1340
that the package contains the three required subdirectories: trunk, tags and
1341
branches.
1342
 
1343
The command will also ensure that packages are not placed at inappropriate
1344
locations within the repository. It is not correct to place a package within
1345
another package.
1346
 
1347
The command will, optionally, import a directory tree into the repository and,
1348
optionally, label the package.
1349
 
1350
The package body may be imported to the 'trunk' or to a branch or a tag.
1351
By default the data will be imported to the trunk and may be labeled (tagged).
1352
 
1353
Options allow the targets to be deleted if they exist or to ensure that they
1354
are not present.
1355
 
1356
The command does not attempt to merge file versions within the repository. It
1357
may result in multiple instances of a file within the repository. Use only for
341 dpurdie 1358
simple imports. Use the 'import' command for more sophisticated import requirements.
311 dpurdie 1359
 
1360
=head1 Import directory to a Package
1361
 
1362
=head2 NAME
1363
 
1364
Import directory to a Package
1365
 
1366
=head2 SYNOPSIS
1367
 
1368
jats svn [options] import URL [command options]
1369
 
1370
 Options:
1371
    -help[=n]               - Help message, [n=1,2,3]
1372
    -man                    - Full documentation [-help=3]
1373
    -verbose[=n]            - Verbose command operation
1374
 
1375
 Command Options
1376
    -help[=n]               - Command specific help, [n=1,2,3]
1377
    -verbose[=n]            - Verbose operation
1378
    -package=name           - Name of source package
1379
    -dir=path               - Path to new version
379 dpurdie 1380
    -label=label            - Label the result
1381
    -branch=branchName      - Base import on a branch
311 dpurdie 1382
    -replace                - Allow the label to be replaced
1383
    -reuse                  - Reuse the import directory
1384
    -workspace=path         - Path and name of alternate workspace
1385
    -[no]delete             - Deletes workspace after use. Default:yes
379 dpurdie 1386
    -author=name            - Force author of changes
1387
    -date=dateString        - Force date of changes
1388
    -log=text               - Append text to the commit message
1389
    -datafile=path          - Export tag data for automation
311 dpurdie 1390
 
379 dpurdie 1391
 
311 dpurdie 1392
=head2 ARGUMENTS
1393
 
1394
The command takes one argument: The URL of the desired package.
1395
This may be be:
1396
 
1397
=over
1398
 
1399
=item * A full URL
1400
 
1401
Complete with protocol and path information.
1402
 
1403
=item * A simple URL
1404
 
1405
JATS will prepend the site-specific repository location to the user provided URL
1406
 
1407
=back
1408
 
1409
=head2 OPTIONS
1410
 
1411
=over
1412
 
1413
=item -help[=n]
1414
 
1415
Print a help message and exit. The level of help may be either 1, 2 or 3.
1416
 
1417
This option may be specified multiple times to increment the help level, or
1418
the help level may be directly specified as a number.
1419
 
1420
=item -verbose[=n]
1421
 
1422
This option will increase the level of verbosity of the utility.
1423
 
1424
If an argument is provided, then it will be used to set the level, otherwise the
1425
existing level will be incremented. This option may be specified multiple times.
1426
 
1427
 
1428
=item -package=name
1429
 
1430
Either this option or a bare URL on the command line must be provided. It
1431
specifies the repository and package to be used as a basis for the work.
1432
 
1433
=item -dir=path
1434
 
1435
This option is mandatory. It specifies the path to a local directory that
1436
contains a version of the software to be checked in.
1437
 
1438
=item -label=name
1439
 
1440
The resulting software version will be labeled with this tag, if it is provided.
1441
 
383 dpurdie 1442
A label name of TIMESTAMP will be treated in special manner. The name will be
1443
replaced with a unique name based on the users name and the current date time.
1444
 
379 dpurdie 1445
=item -branch=branchName
1446
 
1447
This option will cause the importation to be referenced to the named branch.
1448
If the branch does not exist it will be created. If it does exist then it will
1449
be used.
1450
 
1451
If this option is not specified, then the importation will be based on the 'trunk'.
1452
 
1453
If the Workspace is provided, then it will be used independently of this option.
1454
 
383 dpurdie 1455
A branchName of TIMESTAMP will be treated in special manner. The name will be
1456
replaced with a unique name based on the users name and the current date time.
1457
 
311 dpurdie 1458
=item -replace
1459
 
1460
This option, if provided, allows the label to be replaced.
1461
 
1462
=item -reuse
1463
 
1464
This option can be used to speed the creation of multiple versions in a scripted
1465
environment. The option allows the utility to reuse the workspace if it exists.
1466
 
1467
=item -workspace=path
1468
 
1469
This option specifies an alternate workspace directory to create and use. The
1470
default directory is "SvnImportDir" within the users current directory.
1471
 
1472
=item [no]delete
1473
 
341 dpurdie 1474
This option control the deletion of the workspace directory. By default the
311 dpurdie 1475
directory will be deleted, unless re-use is also used.
1476
 
379 dpurdie 1477
=item -author=name
1478
 
1479
This option will force the author of changes as recorded in the repository.
385 dpurdie 1480
The repository must be configured to allow such changes.
379 dpurdie 1481
 
1482
This option may not work for non-admin users.
1483
 
1484
=item -date=dateString
1485
 
1486
This option will force the date of the changes as recorded in the repository.
385 dpurdie 1487
The repository must be configured to allow such changes.
379 dpurdie 1488
The dateString is in a restricted ISO 8601 format: ie 2009-02-12T00:44:04.921324Z
1489
 
1490
This option may not work for non-admin users.
1491
 
1492
=item -log=text
1493
 
1494
This option will append the specified text to the commit message.
1495
The first line of the commit message is fixed by the import tool.
1496
 
1497
=item -datafile=path
1498
 
1499
This option will cause the utility to create a data file to record the import
1500
tag. It is used for automation of the import process.
1501
 
311 dpurdie 1502
=back
1503
 
1504
=head2 DESCRIPTION
1505
 
1506
Import a new version of a package to the trunk of the package. The utility
1507
will only import changed files so that file history is preserved within the
1508
repository.
1509
 
1510
This utility is used import software from another version control system
1511
The utility will:
1512
 
1513
=over
1514
 
361 dpurdie 1515
=item *
311 dpurdie 1516
 
361 dpurdie 1517
Create a Work Space based on the current package version
1518
 
379 dpurdie 1519
The 'trunk' of the named package will be used as the base for the workspace,
1520
unless modified with the -branch option.
311 dpurdie 1521
 
361 dpurdie 1522
=item *
311 dpurdie 1523
 
361 dpurdie 1524
Update files and directories
1525
 
311 dpurdie 1526
Determines the files and directories that have been added and deleted and
1527
update the Workspace to reflect the new structure.
1528
 
361 dpurdie 1529
=item *
311 dpurdie 1530
 
361 dpurdie 1531
Check in the new version
311 dpurdie 1532
 
361 dpurdie 1533
=item *
1534
 
1535
Label the new version
1536
 
311 dpurdie 1537
=back
1538
 
1539
=cut
1540