Subversion Repositories DevTools

Rev

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